A method for live migration of a virtual machine instance
By acquiring and sending virtual machine instance runtime data in real time on cloud servers, the problem of business interruption caused by virtual machine migration was solved, achieving seamless migration and business continuity.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-25
- Publication Date
- 2026-03-31
AI Technical Summary
When migrating virtual machine instances on cloud servers, existing technologies cannot achieve seamless migration, leading to business interruptions.
When the virtual machine instance to be migrated meets the hot migration conditions, the running data of the virtual machine instance on the cloud service device and microservice hardware is acquired and sent in real time, and the virtual machine simulator process is used to migrate it to the target cloud service device.
Seamless migration of virtual machine instances was achieved, ensuring uninterrupted business operations and maintaining real-time online status during the migration process.
Smart Images

Figure CN114691300B_ABST
Abstract
Description
Technical Field
[0001] The embodiments described herein relate to the field of computer technology, and more specifically, the embodiments described herein relate to a method for hot migration of virtual machine instances. Background Technology
[0002] This section is intended to provide background or context for the embodiments of this specification as set forth in the claims. The description herein is not intended to be a prior art simply because it is included in this section.
[0003] Cloud servers typically consist of virtual machine instances implemented using virtualization technology on cloud server devices. These virtual machine instances enable various cloud server services. These services usually need to remain online in real time, so when virtual machine instances need to be migrated from the current cloud service device, these services must not be interrupted. Summary of the Invention
[0004] To overcome the problems existing in the related technologies, this specification provides the following methods and apparatus.
[0005] In a first aspect of the embodiments of this specification, a method for hot migration of virtual machine instances is provided, applied to a cloud service device, the cloud service device being equipped with microservice hardware, and the virtual machine instance to be migrated including a virtual machine emulator process running on the microservice hardware and a virtual machine driver running in the operating system kernel of the cloud service device; the method includes:
[0006] In response to the virtual machine instance to be migrated meeting the hot migration conditions, the virtual machine driver obtains the first running data of the virtual machine instance in the operating system kernel mounted on the cloud service device, and writes the first running data into a preset memory space;
[0007] The virtual machine emulator process obtains the second running data of the virtual machine instance on the microservice hardware and the third running data of the virtual machine instance in the memory space of the cloud service device, and reads the first running data from the preset memory space;
[0008] The virtual machine emulator process sends the first running data, the second running data, and the third running data to the target cloud service device to migrate the virtual machine instance to the target cloud service device.
[0009] In a second aspect of the embodiments of this specification, a hot migration apparatus for virtual machine instances is provided, applied to a cloud service device, the cloud service device being equipped with microservice hardware, the virtual machine instance to be migrated including a virtual machine emulator process running on the microservice hardware and a virtual machine driver running in the operating system kernel of the cloud service device; the apparatus includes:
[0010] The first acquisition unit is configured to, in response to the virtual machine instance to be migrated meeting the hot migration conditions, acquire the first running data of the virtual machine instance in the operating system kernel mounted on the cloud service device, and write the first running data into a preset memory space.
[0011] The second acquisition unit is used to acquire the second running data of the virtual machine instance on the microservice hardware and the third running data of the virtual machine instance in the memory space of the cloud service device by the virtual machine simulator process, and read the first running data from the preset memory space.
[0012] The data sending unit is used to send the first running data, the second running data, and the third running data obtained by the virtual machine emulator process to the target cloud service device, so as to migrate the virtual machine instance to the target cloud service device.
[0013] In a third aspect of the embodiments described in this specification, a system is provided; the system includes: a source cloud service device and a destination cloud service device;
[0014] The source cloud service device is equipped with source microservice hardware, and the virtual machine instances to be migrated include virtual machine emulator processes running on the microservice hardware and virtual machine drivers running in the operating system kernel of the source cloud service device.
[0015] The source cloud service device is configured to: respond to the virtual machine instance to be migrated meeting the hot migration conditions, the operating system kernel obtains the first running data of the virtual machine instance in the operating system kernel mounted on the source cloud service device, and writes the first running data into a preset memory space; the virtual machine emulator process obtains the second running data of the virtual machine instance on the source microservice hardware and the third running data of the virtual machine instance in the memory space of the source cloud service device, and reads the first running data from the preset memory space; the virtual machine emulator process sends the obtained first running data, second running data and third running data to the target cloud service device to migrate the virtual machine instance to the target cloud service device;
[0016] The target cloud service device is equipped with the target microservice hardware;
[0017] The target cloud service device is configured to: in response to the virtual machine instance to be migrated meeting the hot migration conditions, receive the first running data, the second running data, and the third running data sent by the source cloud service device; and create a virtual machine instance based on the received running data, wherein the virtual machine instance includes a virtual machine emulator process running on the target microservice hardware and a virtual machine driver running in the operating system kernel mounted on the target cloud service device, so as to complete the migration of the virtual machine instance from the source cloud service device to the target cloud service device.
[0018] In a fourth aspect of the embodiments of this specification, a storage medium is provided; the storage medium stores a computer program that, when executed, performs the steps of the method described below:
[0019] In response to the virtual machine instance to be migrated meeting the hot migration conditions, the operating system kernel obtains the first running data of the virtual machine instance in the operating system kernel mounted on the cloud service device, and writes the first running data into a preset memory space;
[0020] The virtual machine emulator process obtains the second running data of the virtual machine instance on the microservice hardware and the third running data of the virtual machine instance in the memory space of the cloud service device, and reads the first running data from the preset memory space;
[0021] The virtual machine emulator process sends the first running data, the second running data, and the third running data to the target cloud service device to migrate the virtual machine instance to the target cloud service device.
[0022] In a fifth aspect of the embodiments of this specification, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the following method:
[0023] In response to the virtual machine instance to be migrated meeting the hot migration conditions, the operating system kernel obtains the first running data of the virtual machine instance in the operating system kernel mounted on the cloud service device, and writes the first running data into a preset memory space;
[0024] The virtual machine emulator process obtains the second running data of the virtual machine instance on the microservice hardware and the third running data of the virtual machine instance in the memory space of the cloud service device, and reads the first running data from the preset memory space;
[0025] The virtual machine emulator process sends the first running data, the second running data, and the third running data to the target cloud service device to migrate the virtual machine instance to the target cloud service device.
[0026] The embodiments described above in this specification have at least the following beneficial effects:
[0027] In the above technical solution, when the virtual machine instance to be migrated meets the hot migration conditions, the running data of the virtual machine instance on the cloud service device and microservice hardware is acquired in real time, and the running data of the virtual machine instance to be migrated is sent to the target service device through the virtual machine emulator process. Since all the running data of the virtual machine instance to be migrated is transferred to the target service device, the migrated virtual machine instance can continue to run on the target service device without causing business interruption. Attached Figure Description
[0028] To more clearly illustrate the technical solutions in the embodiments or prior art of this specification, the drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For those skilled in the art, other drawings can be obtained based on these drawings.
[0029] Figure 1 A schematic diagram illustrating an instance of a virtual machine according to an embodiment of this specification is shown.
[0030] Figure 2 A schematic diagram of the architecture of a live migration system for a virtual machine instance according to an embodiment of this specification is shown.
[0031] Figure 3 A flowchart illustrating a method for hot migration of a virtual machine instance according to an embodiment of this specification is shown schematically.
[0032] Figure 4 A block diagram schematically illustrates a hot migration apparatus for a virtual machine instance according to an embodiment of this specification;
[0033] Figure 5 A schematic diagram of the architecture of a live migration system for a virtual machine instance according to an embodiment of this specification is shown.
[0034] Figure 6 A schematic diagram of a hardware structure of a computer device in which a hot migration method for a virtual machine instance according to an embodiment of this specification is provided is illustrated.
[0035] In the accompanying drawings, the same or corresponding reference numerals indicate the same or corresponding parts. Detailed Implementation
[0036] The principles and spirit of this specification will now be described with reference to several exemplary embodiments. It should be understood that these embodiments are given merely to enable those skilled in the art to better understand and implement this specification, and are not intended to limit the scope of this specification in any way. Rather, these embodiments are provided to make this specification more thorough and complete, and to fully convey the scope of this specification to those skilled in the art.
[0037] Those skilled in the art will recognize that the embodiments described herein can be implemented as a system, apparatus, device, method, or computer program product. Therefore, this specification can be specifically implemented in the following forms: entirely hardware, entirely software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
[0038] Cloud servers are service platforms deployed in the cloud, implemented using virtualization and cloud computing technologies. Microservice architecture is one type of cloud server architecture.
[0039] For example, see Figure 1 , Figure 1 A schematic diagram of the structure of a virtual machine instance according to an embodiment of this specification is shown.
[0040] A microservices architecture cloud server introduces a microservices hardware component on a physical server and runs an operating system independently on that microservices hardware. This microservices hardware can be a microservices card connected to the physical server via a bus, providing services such as virtualization of input / output I / O devices, processing and forwarding of I / O requests, etc., making the physical server as flexible as a virtual machine.
[0041] When virtual machine instances are deployed on cloud servers with the microservice architecture described above, the virtual machine instances can adopt a separate architecture. The virtual machine emulator process can run on the microservice hardware, and the virtual machine emulator process and the physical server operating system kernel can be used to virtualize hardware devices such as CPU, memory, input / output devices, etc., to realize the virtual machine instance.
[0042] Multiple virtual machine instances can be deployed simultaneously on the physical server, and these multiple virtual machine instances can share the operating system kernel of the physical server.
[0043] In scenarios using cloud servers with the microservice architecture described above, virtual machine instances on a certain cloud service device may need to be migrated to a new cloud service device under certain circumstances.
[0044] Due to the various services running on cloud servers, these services typically need to remain online in real time. Therefore, when virtual machine instances need to be migrated from the current cloud service device, these services must not be interrupted.
[0045] In view of this, this application proposes a hot migration method for virtual machine instances that, when the virtual machine instance to be migrated meets the hot migration conditions, acquires the running data of the virtual machine instance to be migrated on cloud service devices and microservice hardware in real time, and sends the running data of the virtual machine instance to be migrated to the target service device through the virtual machine simulator process.
[0046] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0047] It should be noted that the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification in other embodiments. In some other embodiments, the methods may include more or fewer steps than described in this specification. Furthermore, a single step described in this specification may be broken down into multiple steps in other embodiments; and multiple steps described in this specification may be combined into a single step in other embodiments.
[0048] Figure 2 This is a schematic diagram of the architecture of a live migration system for virtual machine instances, provided in an exemplary embodiment. For example... Figure 1 As shown, the system may include a network 20, a server 21, and several electronic devices, such as mobile phones 22, 23, and 24.
[0049] Server 21 can be a physical server containing a single host, or it can be a virtual server, cloud server, etc., hosted by a host cluster. Mobile phones 22-24 are just one type of electronic device that users can use. In reality, users can obviously also use electronic devices such as tablets, laptops, PDAs (Personal Digital Assistants), wearable devices (such as smart glasses, smartwatches, etc.), etc., and this specification does not limit this to one or more embodiments. Network 20 can include various types of wired or wireless networks.
[0050] In one embodiment, server 21 can cooperate with mobile phones 22-24; wherein mobile phones 22-24 can receive user operations and upload the received commands and files to server 21 via network 20, and then server 21 processes the files based on the scheme described in this specification. In another embodiment, mobile phones 22-24 can independently implement the text processing scheme described in this specification; wherein mobile phones 22-24 receive user operations and process the received commands and files based on the scheme described in this specification to achieve hot migration of virtual machine instances.
[0051] The following is a detailed description of the scheme in this specification, with reference to the accompanying drawings.
[0052] Please see Figure 3 , Figure 3 This is a flowchart of a hot migration method for a virtual machine instance provided in an exemplary embodiment. The method is applied to a processing device, which may be, for example, a... Figure 2 The server 21 or mobile phones 22-24 shown are examples of this.
[0053] This method is applied to cloud service devices that are equipped with microservice hardware. The virtual machine instances to be migrated include virtual machine emulator processes running on the microservice hardware and virtual machine drivers running in the operating system kernel of the cloud service device.
[0054] Virtual machine instances on cloud servers include virtual machine emulator processes running on microservice hardware and operating system kernel drivers running on cloud server devices. These virtual machine emulator processes and kernel drivers together virtualize hardware such as CPU, memory, and input / output devices.
[0055] In one embodiment shown in this specification, the virtual machine emulator process implements the virtualization of hardware such as input / output devices, and the kernel driver together implements the virtualization of hardware such as CPU and memory.
[0056] In one embodiment illustrated in this specification, the microservice hardware includes a microservice card.
[0057] Microservice cards, such as MOC (microserver on card) cards, are a type of microservice hardware. They are physical board devices with their own CPU and ROM / RAM, capable of running an independent operating system. They can also be connected to a physical server via a system bus (such as PCIe) to provide services such as virtual input / output devices, processing and forwarding input / output requests.
[0058] This manual does not limit the specific type of operating system that runs on the cloud service device; for example, it can be Linux, macOS, or Windows.
[0059] This manual does not limit the specific type of virtual machine instance. For example, it can be a KVM (Kernel-based Virtual Machine) virtual machine instance, a Xen virtual machine instance, or a vbox virtual machine instance, etc.
[0060] Similarly, this instruction does not limit the specific type of virtual machine emulator process; for example, it can be a QEMU process, a VMware process, etc.
[0061] In one embodiment illustrated in this specification, the virtual machine instance includes a KVM virtual machine instance; the virtual machine emulator process includes a QEMU process.
[0062] The cloud service equipment described above can run on Linux, and the virtual machine instance can be a KVM virtual machine instance. The KVM virtual machine instance includes a virtual machine driver integrated into the Linux operating system kernel as a module, as well as the aforementioned QEMU process.
[0063] The above method involves the following steps:
[0064] Step 302: In response to the virtual machine instance to be migrated meeting the hot migration conditions, the operating system kernel obtains the first running data of the virtual machine instance in the operating system kernel mounted on the cloud service device, and writes the first running data into a preset memory space.
[0065] In some cases, virtual machine instances on cloud service devices may need to be hot-migrated. This application does not specify the exact form and content of the hot migration conditions that the virtual machine instances to be migrated must meet.
[0066] In one exemplary embodiment illustrated in this application, the hot migration condition for a virtual machine instance may be that the value corresponding to the running metric of the virtual machine instance reaches a preset threshold. It should be understood that the value corresponding to the running metric reaching the preset threshold may be that one or more running metrics are lower than the preset threshold, one or more running metrics are higher than the preset threshold, one or more running metrics are equal to or not equal to the preset threshold, or a logical combination of the above situations. This specification does not specifically limit this.
[0067] For example, the thermal migration conditions could be that the operating index A > 100 and the operating index B is within the range (1, 10].
[0068] Once the virtual machine instance to be migrated meets the above hot migration conditions, the migration of the relevant runtime data of the virtual machine instance to be migrated begins.
[0069] The runtime data of the virtual machine instance includes: first runtime data of the virtual machine instance in the operating system kernel of the cloud service device, second runtime data of the virtual machine instance on the microservice hardware, and third runtime data of the virtual machine instance in the memory space of the cloud service device.
[0070] In one illustrative embodiment shown in this specification, the first operational data includes virtual CPU status data and virtual device status data of the virtual machine instance on the cloud service device.
[0071] The virtual CPU status data mentioned above may include virtual CPU status such as vcpu_regs (general-purpose register data), vcpu_sregs (segment register data), and fpu (floating-point unit data).
[0072] The virtual device status data mentioned above may include device status data such as clock (clock data), ioapic (input / output advanced programmable interrupt controller data), and rtc (real-time clock data).
[0073] This specification does not specifically limit the organization format of the first running data described above. For example, the first running data can be organized using a structure, or other data types can be used.
[0074] The first running data in the operating system kernel of the aforementioned cloud service device can be obtained through the operating system kernel and written into a preset memory space.
[0075] This specification does not specify how the operating system kernel obtains the aforementioned initial runtime data or writes it into memory. For example, it can be implemented directly through a virtual machine driver within the operating system kernel, or it can be implemented through other programs within the operating system kernel.
[0076] In one illustrative embodiment shown in this specification, a service program for acquiring and storing the first runtime data can be implemented in the operating system kernel of the aforementioned cloud service device. Callback functions can be registered in the operating system kernel of the aforementioned cloud service device.
[0077] When a virtual machine instance meets the conditions for hot migration, the aforementioned callback function can be triggered to initiate a call to the aforementioned service program. The aforementioned service program can run in the operating system kernel of the cloud service device to obtain the initial running data of the virtual machine instance on the cloud service device and write the initial running data into a preset memory space.
[0078] For example, let's take a KVM virtual machine instance as an example, and the cloud service device as running Linux as an example.
[0079] The KVM module includes virtual machine drivers that are integrated into the Linux operating system kernel as modules. Virtual machine drivers can manage virtual hardware resources and perform tasks such as allocating virtual machine memory, reading and writing virtual machine registers, and running the virtual machine CPU.
[0080] A service program called kvm_save, used to acquire and store the first running data, can be implemented in the Linux operating system kernel running the cloud service device. A callback function can be created and registered with the Linux kernel operating system, and the trigger condition for this callback function can be set to the aforementioned hot migration condition.
[0081] When a virtual machine instance meets the hot migration conditions, the callback function can be triggered. The service program kvm_save obtains the first running data on the cloud service device, including virtual CPU status data and virtual device status data, and saves it to the preset memory space.
[0082] This specification does not limit the method by which the above-mentioned service program obtains the first running data.
[0083] For example, taking a KVM virtual machine instance as an example, and the cloud service device running Linux as an operating system, when the virtual machine instance is created, the KVM module creates a corresponding `struct_kvm` structure for storing the virtual CPU state and synchronizes the address of this `struct_kvm` to the service program `kvm_save`. The virtual CPU state is saved in the `struct_kvm` structure as a `vmcs` (Virtual Machine Control Structure) data structure. When the hot migration conditions are met, the service program `kvm_save` can call the virtual CPU state read function `vmcs_read` to retrieve the corresponding virtual CPU state data from the `vmcs` data structure stored in the `struct_kvm` structure.
[0084] In one illustrative embodiment shown in this specification, the preset memory region includes reserved memory space requested from the memory space of the cloud service device corresponding to the virtual machine instance when the virtual machine instance is created.
[0085] When creating a virtual machine instance, reserved memory can be requested in the memory space of the cloud service device corresponding to the virtual machine instance. This reserved memory can be used to write the aforementioned first running data into the reserved memory when the hot migration conditions are met.
[0086] Since the reserved memory space is located in the memory of the aforementioned cloud service device, rather than in the memory of the virtual machine instance, it is still relatively easy to read the reserved memory space after the virtual machine instance stops running.
[0087] This application does not limit the specific method for requesting reserved memory. For example, it can be implemented through the virtual machine emulator process mentioned above, or through the operating system kernel running on the cloud service device mentioned above.
[0088] For example, taking a KVM virtual machine instance as an example and a Linux operating system on the cloud service device as an example, the aforementioned reserved memory can be requested by the virtual machine emulator process through the input / output control function IOCTL in the aforementioned service program kvm_save, allocated through the memory allocation function kzalloc, and obtaining the physical address of this memory space. This ensures that the service program kvm_save can write the first running data it obtains into the reserved memory space after obtaining the first running data.
[0089] Step 304: The virtual machine emulator process obtains the second running data of the virtual machine instance on the microservice hardware, and reads the first running data from the preset memory space;
[0090] After the first running data is written into the reserved memory space, the virtual machine emulator process can obtain the first running data from the reserved memory space.
[0091] In addition to the first set of runtime data mentioned above, hot migration of virtual machine instances also requires the migration of the second set of runtime data of the virtual machine instances on the microservice hardware. Therefore, the virtual machine emulator process can obtain the second set of runtime data of the virtual machine instances on the microservice hardware.
[0092] In one illustrative embodiment shown in this specification, the second runtime data includes: virtual device status data of the virtual machine instance on the microservice hardware.
[0093] The runtime data of the virtual machine instance includes the device status data on the aforementioned microservice hardware.
[0094] This specification does not specifically limit the method by which the virtual machine emulator process obtains device status data on the aforementioned microservice hardware.
[0095] For example, in one illustrative embodiment shown, this part of the device status data can typically be stored by a virtual machine emulator process on the microservice hardware, and therefore can be directly obtained by the aforementioned virtual machine emulator process.
[0096] In one illustrative embodiment shown in this specification, the third runtime data includes: data written by the virtual machine instance to the memory space corresponding to the virtual machine instance.
[0097] The runtime data of a virtual machine instance includes the memory data of that virtual machine instance, that is, the data written to the memory space corresponding to that virtual machine instance.
[0098] The memory space corresponding to the virtual machine instance mentioned above is virtualized memory, which can be obtained by virtualizing the memory of the cloud server device mentioned above.
[0099] The virtual machine emulator process can manage the data in the memory space corresponding to the virtual machine instance. Therefore, the virtual machine emulator process can obtain the memory data of the virtual machine instance.
[0100] For example, when the virtual machine emulator process is the QEMU process, it can manage the memory space corresponding to the virtual machine instance using the MemoryRegion method. When managing the memory space of the virtual machine instance using MR (MemoryRegion), an MR represents a memory address. MRs include various types, such as RAM, MMIO, container, and alias. The QEMU process can create a data structure named RamBlock for each of these MRs, and all RamBlocks are linked together in a linked list.
[0101] When the hot migration conditions are met, the QEMU process can read the RamBlock linked list mentioned above to obtain the client physical addresses (GPAs) of various memory types. Some MR client physical addresses are stored as variables in the QEMU process and can be directly accessed; some special MRs have reserved blank memory, the size of which can be recorded in advance using a structure. Based on the read value and the size of that blank memory, the client physical address of the actual memory data can be calculated.
[0102] The Input / Output Memory Management Unit (IOMMU) of the virtual machine instance can translate the physical addresses of various types of memory into the physical addresses of the memory on the cloud service device. Based on the physical addresses of the memory on the cloud service device, the QEMU process can obtain the data of the memory space corresponding to the virtual machine instance through the DMA channel of the virtual machine instance.
[0103] Step 306: The virtual machine emulator process sends the first running data, the second running data, and the third running data to the target cloud service device to migrate the virtual machine instance to the target cloud service device.
[0104] Once the first, second, and third running data are obtained, the virtual machine emulator process can send the running data of these virtual machine instances to the target cloud server device.
[0105] This manual does not impose specific limitations on the selection of the target cloud service device. For example, an available cloud service device can be randomly selected as the target cloud server, or the user can specify a particular cloud service device as the target cloud server.
[0106] In one embodiment illustrated in this specification, cloud service devices currently in a normal state can be acquired; and a target cloud service device can be allocated from these normal cloud service devices as the migration target. The target cloud service device can be any one of the aforementioned normal cloud service devices.
[0107] This application does not specifically limit the method by which the virtual machine emulator process sends the above-mentioned runtime data to the target cloud server device.
[0108] In an exemplary embodiment of this specification, a hot migration apparatus for a virtual machine instance is also provided. See also... Figure 4 , Figure 4 This is a block diagram of a hot migration device for a virtual machine instance according to an embodiment of this specification.
[0109] This device is applied to a cloud service device equipped with microservice hardware. The virtual machine instances to be migrated include virtual machine emulator processes running on the microservice hardware and virtual machine drivers running in the operating system kernel of the cloud service device. The device includes:
[0110] The first acquisition unit 410 is used to, in response to the virtual machine instance to be migrated meeting the hot migration conditions, acquire the first running data of the virtual machine instance in the operating system kernel mounted on the cloud service device, and write the first running data into a preset memory space.
[0111] The second acquisition unit 420 is used to acquire the second running data of the virtual machine instance on the microservice hardware and the third running data of the virtual machine instance in the memory space of the cloud service device by the virtual machine emulator process, and read the first running data from the preset memory space.
[0112] The data sending unit 440 is used to send the first running data, the second running data and the third running data obtained by the virtual machine emulator process to the target cloud service device, so as to migrate the virtual machine instance to the target cloud service device.
[0113] Optionally, the hot migration conditions include any of the following: the value of the running metric of the virtual machine instance reaches a preset threshold; or a hot migration instruction for the virtual machine instance is received.
[0114] Optionally, a service program for acquiring and storing the first running data is implemented in the operating system kernel of the cloud service device; a callback function is registered in the operating system kernel of the cloud service device; the callback function is automatically triggered when the virtual machine instance meets the hot migration conditions, and is used to initiate a call to the service program;
[0115] The first acquisition unit 410 is specifically used to respond to the virtual machine instance meeting the hot migration conditions, trigger the callback function, initiate a call to the service program, so as to run the service program in the operating system kernel mounted on the cloud service device, and the service program obtains the first running data of the virtual machine instance on the cloud service device and writes the first running data into a preset memory space.
[0116] Optionally, the preset memory region includes reserved memory space requested from the memory space of the cloud server device corresponding to the virtual machine instance when the virtual machine instance is created.
[0117] Optionally, the first running data includes: virtual CPU status data and virtual device status data of the virtual machine instance on the cloud service device; the second running data includes: virtual device status data of the virtual machine instance on the microservice hardware; and the third running data includes: data written by the virtual machine instance to the memory space corresponding to the virtual machine instance.
[0118] Optionally, the apparatus further includes: a target selection unit 430, configured to acquire cloud service devices currently in a normal state; and allocate a target cloud service device as the migration target from the cloud service devices in the normal state.
[0119] Optionally, the microservice hardware includes a microservice card.
[0120] Optionally, the virtual machine instance includes a KVM virtual machine instance; the virtual machine emulator process includes a QEMU process.
[0121] The specific implementation process of the functions and roles of each unit in the above device can be found in the implementation process of the corresponding steps in the above method, and will not be repeated here.
[0122] For the apparatus embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The apparatus embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the solution in this specification according to actual needs. Those skilled in the art can understand and implement this without creative effort.
[0123] In exemplary embodiments of this specification, a system embodiment is also provided. Please refer to... Figure 5 , Figure 5 This is a schematic diagram of the architecture of a hot migration system for a virtual machine instance according to an embodiment of this specification.
[0124] The system includes: source cloud service equipment and destination cloud service equipment;
[0125] The source cloud service device is equipped with source microservice hardware, and the virtual machine instances to be migrated include virtual machine emulator processes running on the microservice hardware and virtual machine drivers running in the operating system kernel of the source cloud service device.
[0126] The source cloud service device is configured to: respond to the virtual machine instance to be migrated meeting the hot migration conditions, the operating system kernel obtains the first running data of the virtual machine instance in the operating system kernel mounted on the source cloud service device, and writes the first running data into a preset memory space; the virtual machine emulator process obtains the second running data of the virtual machine instance on the source microservice hardware and the third running data of the virtual machine instance in the memory space of the source cloud service device, and reads the first running data from the preset memory space; the virtual machine emulator process sends the obtained first running data, second running data and third running data to the target cloud service device to migrate the virtual machine instance to the target cloud service device;
[0127] The target cloud service device is equipped with the target microservice hardware;
[0128] The target cloud service device is configured to: in response to the virtual machine instance to be migrated meeting the hot migration conditions, receive the first running data, the second running data, and the third running data sent by the source cloud service device; and create a virtual machine instance based on the received running data, wherein the virtual machine instance includes a virtual machine emulator process running on the target microservice hardware and a virtual machine driver running in the operating system kernel mounted on the target cloud service device, so as to complete the migration of the virtual machine instance from the source cloud service device to the target cloud service device.
[0129] In exemplary embodiments of this specification, an embodiment of an apparatus and a terminal to which it is applied is also provided.
[0130] The embodiments of the live migration device for virtual machine instances described in this specification can be applied to computer devices, such as servers or terminal devices. The device embodiments can be implemented in software, hardware, or a combination of both. Taking software implementation as an example, as a logical device, it is formed by the processor reading the corresponding computer program instructions from non-volatile memory into memory for execution. From a hardware perspective, such as... Figure 6 The diagram shown is a hardware structure diagram of a computer device 60 containing a hot migration device for a virtual machine instance according to an embodiment of this specification. Except for... Figure 6 In addition to the processor 612, memory 630, network interface 620, and non-volatile memory 540 shown, the server or electronic device in which the device is located in the embodiment may also include other hardware depending on the actual function of the computer device, which will not be described in detail here.
[0131] In exemplary embodiments of this specification, a computer-readable storage medium is also provided, on which a program product capable of implementing the methods described above is stored. In some possible embodiments, various aspects of this specification may also be implemented as a program product including program code that, when the program product is run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments.
[0132] The program product for implementing the above-described methods according to embodiments of this specification may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of this specification is not limited thereto. In this document, a readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0133] The program product may employ any combination of one or more readable media. A readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0134] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of sending, propagating, or transmitting programs for use by or in conjunction with an instruction execution system, apparatus, or device.
[0135] The program code contained on the readable medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0136] Program code for performing the operations described herein can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0137] While this specification contains numerous specific implementation details, these should not be construed as limiting the scope of any invention or the scope of the claims, but rather are primarily intended to describe features of specific embodiments of a particular invention. Certain features described in the various embodiments herein may also be implemented in combination in a single embodiment. Conversely, various features described in a single embodiment may also be implemented separately in various embodiments or in any suitable sub-combination. Furthermore, while features may function in certain combinations as described above and even initially claimed in this way, one or more features from a claimed combination may be removed from that combination in some cases, and a claimed combination may refer to a sub-combination or a variation thereof.
[0138] Similarly, although the operations are depicted in a specific order in the accompanying drawings, this should not be construed as requiring these operations to be performed in the specific order shown or sequentially, or requiring all illustrated operations to be performed to achieve the desired result. In some cases, multitasking and parallel processing may be advantageous. Furthermore, the separation of various system units and components in the above embodiments should not be construed as requiring such separation in all embodiments, and it should be understood that the described program components and systems can generally be integrated together in a single software product or packaged into multiple software products.
[0139] Thus, specific embodiments of the subject matter have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions recited in the claims may be performed in a different order and still achieve the desired result. Furthermore, the processes depicted in the drawings are not necessarily shown in a specific order or sequence to achieve the desired result. In some implementations, multitasking and parallel processing may be advantageous.
[0140] The above description is merely a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of protection of this specification.
Claims
1. A method for hot migration of virtual machine instances, applied to cloud service devices, characterized in that, The cloud service device is equipped with micro-service hardware, the micro-service hardware includes: a micro-service card capable of running an independent operating system; the virtual machine instance to be migrated includes a virtual machine emulator process running on the micro-service hardware and a virtual machine driver running in the operating system kernel of the cloud service device; the method includes: In response to the virtual machine instance to be migrated meeting the hot migration condition, the operating system kernel obtains first running data of the virtual machine instance in the operating system kernel of the cloud service device and writes the first running data into a preset memory space; The virtual machine emulator process obtains second running data of the virtual machine instance on the micro-service hardware and third running data of the virtual machine instance in the memory space of the cloud service device, and reads the first running data from the preset memory space; the preset memory space includes: a physical reserved memory space applied by the virtual machine emulator process from the memory space of the cloud service device corresponding to the virtual machine instance when the virtual machine instance is created; The virtual machine emulator process sends the obtained first running data, second running data and third running data to a target cloud service device to migrate the virtual machine instance to the target cloud service device.
2. The method of claim 1, wherein the hot migration condition includes any of the following: a value corresponding to a running index of the virtual machine instance reaches a preset threshold; or a hot migration instruction for the virtual machine instance is received.
3. The method of claim 1, wherein a service program for obtaining and storing the first running data is implemented in the operating system kernel of the cloud service device; a callback function is registered in the operating system kernel of the cloud service device; the callback function is automatically triggered when the virtual machine instance meets the hot migration condition, and is used to initiate a call to the service program; The operating system kernel obtains first running data of the virtual machine instance in the operating system kernel of the cloud service device and writes the first running data into a preset memory space, including: In response to the virtual machine instance meeting the hot migration condition, triggering the callback function to initiate a call to the service program to run the service program in the operating system kernel of the cloud service device, obtaining the first running data of the virtual machine instance on the cloud service device by the service program, and writing the first running data into a preset memory space.
4. The method of claim 1, wherein the first running data includes: virtual CPU state data and virtual device state data of the virtual machine instance on the cloud service device; the second running data includes: virtual device state data of the virtual machine instance on the micro-service hardware; and the third running data includes: data written by the virtual machine instance into the memory space corresponding to the virtual machine instance.
5. The method of claim 1, wherein Before the virtual machine emulator process sends the first running data, the second running data and the third running data to the target cloud service device, the virtual machine emulator process further comprises: obtaining a cloud service device currently in a normal state; allocating a target cloud service device as a migrated party from the cloud service device in the normal state.
6. The method of claim 1, wherein: the virtual machine instance comprises a KVM virtual machine instance; the virtual machine emulator process comprises a QEMU process.
7. An apparatus for live migration of a virtual machine instance, applied to a cloud service device, comprising: The cloud service device is equipped with micro-service hardware, and the micro-service hardware comprises a micro-service card capable of running an independent operating system; the virtual machine instance to be migrated comprises a virtual machine emulator process running on the micro-service hardware and a virtual machine driver running in an operating system kernel of the cloud service device; and the apparatus comprises: a first obtaining unit configured to, in response to the virtual machine instance to be migrated satisfying a hot migration condition, obtain, by the operating system kernel, first running data of the virtual machine instance in the operating system kernel of the cloud service device and write the first running data into a preset memory space; the preset memory space comprises a physical reserved memory space applied by the virtual machine emulator process from a memory space of a cloud service device corresponding to the virtual machine instance when the virtual machine instance is created; a second obtaining unit configured to obtain, by the virtual machine emulator process, second running data of the virtual machine instance on the micro-service hardware and third running data of the virtual machine instance in a memory space of the cloud service device, and read the first running data from the preset memory space; a data sending unit configured to send, by the virtual machine emulator process, the obtained first running data, second running data and third running data to a target cloud service device, so as to migrate the virtual machine instance to the target cloud service device.
8. A system, characterized by The system comprises a source cloud service device and a target cloud service device; The source cloud service device is equipped with source micro-service hardware, and the micro-service hardware comprises a micro-service card capable of running an independent operating system; the virtual machine instance to be migrated comprises a virtual machine emulator process running on the micro-service hardware and a virtual machine driver running in an operating system kernel of the source cloud service device; The source cloud service device is configured to: in response to the virtual machine instance to be migrated satisfying a hot migration condition, the operating system kernel acquires first running data of the virtual machine instance in the operating system kernel carried by the source cloud service device and writes the first running data into a preset memory space; the virtual machine simulator process acquires second running data of the virtual machine instance on the source micro-service hardware and third running data of the virtual machine instance in the memory space of the source cloud service device and reads the first running data from the preset memory space; the virtual machine simulator process sends the acquired first running data, second running data and third running data to a target cloud service device to migrate the virtual machine instance to the target cloud service device; the preset memory space includes a physical reserved memory space applied by the virtual machine simulator process from the memory space of the cloud service device corresponding to the virtual machine instance when the virtual machine instance is created; The target cloud service device carries a target micro-service hardware; The target cloud service device is configured to: in response to the virtual machine instance to be migrated satisfying the hot migration condition, accept the first running data, the second running data and the third running data sent by the source cloud service device; and create a virtual machine instance according to the received running data, the virtual machine instance including a virtual machine simulator process running on the target micro-service hardware and a virtual machine driver running in the operating system kernel carried by the target cloud service device, to complete migration of the virtual machine instance from the source cloud service device to the target cloud service device.
9. A storage medium, characterized by A computer program is stored thereon, which, when executed, implements the steps of the method of any one of claims 1-6.
10. A computer device, comprising: A computer program is stored thereon, which, when executed, implements the steps of the method of any one of claims 1-6.
Citation Information
Patent Citations
Virtual machine migration method, device and system
CN106681802A
Virtual machine thermal migration method and communication equipment
CN112306650A
Systems and methods for enabling migratory virtual machines to expedite access to resources
US9575789B1