Method for upgrading virtual manager, and device and storage medium
By using memory addresses to pass virtual instance status information during the hot upgrade of KVM virtualization management components, the problem of long virtual machine pause time is solved, and the virtual instance pause time is lower and the user service is achieved.
Patent Information
- Application Number
- PCT/CN2024/113699
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-09-18
- Filing Date
- 2024-08-21
- Publication Date
- 2025-03-27
AI Technical Summary
In cloud computing scenarios, during the hot upgrade of KVM virtualization management components, the virtual machine pause time is longer, resulting in user service jitter.
By passing the memory address of the virtual instance status information between the original virtualization manager and the upgraded new virtualization manager during the virtualization manager upgrade process, rather than performing data replication, the time overhead in the state recovery process is reduced.
Reduces the pause time of virtual instances during the virtualization manager upgrade, reduces jitter in user applications, and ensures service performance.
Smart Images

Figure CN2024113699_27032025_PF_FP_ABST
Abstract
Description
Upgrading method, device and storage medium of virtualization manager
[0001] This disclosure claims priority to application number 202311206139.7, filed with the China Patent Office on September 18, 2023, and entitled “Upgrading method, device and storage medium for virtualization manager,” the entire contents of which are incorporated by reference into this disclosure. Technical Field
[0002] The present disclosure relates to the field of computer technology, and in particular to a method, device, and storage medium for upgrading a virtualization manager. Background Art
[0003] In cloud computing scenarios, tenants, as cloud users, expect virtual machines (VMs) to run their applications uninterrupted and stably. Kernel-based Virtual Machine (KVM), a core virtualization component, frequently releases new versions to address security vulnerabilities, functional issues, and other issues. This requires cloud vendors to be able to hot-upgrade this component. This means that VMs cannot be terminated or suspended for extended periods during KVM upgrades to avoid noticeable service interruptions for users.
[0004] During the traditional KVM hot upgrade process, the virtual machine operation is suspended for a long time, which results in a long virtual machine suspension time (Downtime).
[0005] Summary of the Invention
[0006] Various aspects of the present disclosure provide a method, device, and storage medium for upgrading a virtualization manager, so as to reduce the pause duration of a virtual instance during a hot upgrade of the virtualization manager.
[0007] The present disclosure provides a method for upgrading a virtualization manager, including:
[0008] The first virtualization manager suspends the operation of the virtual instance on the host machine in response to the virtualization manager upgrade event;
[0009] The first virtualization manager saves the virtual instance state information in the first virtualization manager to the target memory of the host machine; the virtual instance state information is the state information of the virtual instance;
[0010] The first virtualization manager provides the address information of the target memory to the second virtualization manager; the second virtualization manager is used to upgrade the first virtualization manager;
[0011] The second virtualization manager obtains the virtual instance state information according to the memory address information; and restores the state of the virtual instance in the second virtualization manager according to the virtual instance state information.
[0012] The present disclosure also provides a method for upgrading a virtualization manager, wherein a first virtualization management component and a second virtualization management component of the virtualization manager for upgrading the first virtualization management component are running in kernel mode on a host machine; the method comprises:
[0013] A first virtualization management process running in a user state of the host machine creates a second virtualization management process in the user state in response to a virtualization manager upgrade event; the first virtualization management process collaborates with the first virtualization management component; and the second virtualization management process collaborates with the second virtualization management component;
[0014] The first virtualization management component saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state in response to the virtual instance state save request sent by the first virtualization management process; and provides memory address information of the virtual instance state information to the first virtualization management process;
[0015] The first virtualization management process provides the memory address information of the virtual instance state information to the second virtualization management process;
[0016] The second virtualization management component responds to the virtual instance state recovery request sent by the second virtualization management process, obtains the virtual instance state information according to the memory address information of the virtual instance state information contained in the virtual instance state recovery request; and restores the state of the virtual instance in the second virtualization management component according to the virtual instance state information.
[0017] The present disclosure also provides a method for upgrading a virtualization manager, wherein a host machine runs, in kernel mode, a first virtualization management component and a second virtualization management component of the virtualization manager for upgrading the first virtualization management component; and a first virtualization management process that collaborates with the first virtualization management component runs in user mode on the host machine. The method includes:
[0018] The first virtualization management process creates a second virtualization management process in the user state in response to the virtualization manager upgrade event; the second virtualization management process cooperates with the second virtualization management component;
[0019] The first virtualization management process suspends the operation of the virtual instance on the host machine;
[0020] The first virtualization management component saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state in response to the virtual instance state save request sent by the first virtualization management process;
[0021] The first virtualization management component provides the memory address information of the virtual instance state information to the first virtualization management process, so that the first virtualization management process provides the memory address information to the second virtualization management process;
[0022] The second virtualization management component obtains the virtual instance state information according to the memory address information in the virtual instance state recovery request sent by the second virtualization management process;
[0023] The second virtualization management component restores the state of the virtual instance in the second virtualization management component according to the virtual instance state information.
[0024] The present disclosure also provides a computing device, which can be implemented as a host machine; the computing device includes: a memory and a processor; wherein the memory is used to store computer programs corresponding to the first virtualization manager and the second virtualization manager, as well as other computer programs;
[0025] The processor is coupled to the memory and is configured to execute a computer program stored in the memory to perform the steps of the above-mentioned method for upgrading the virtualization manager.
[0026] The embodiment of the present disclosure further provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned virtualization manager upgrade method.
[0027] In the embodiment of the present disclosure, during the virtualization manager upgrade process, when the virtual instance state is saved and restored, the memory address of the virtual instance state information is transmitted between the original virtualization manager and the upgraded new virtualization manager. Compared with the traditional solution in which the virtual instance state information needs to be copied back and forth between the user-state virtualization management process and the kernel-state virtualization manager, the amount of data copied between the original virtualization manager and the new virtualization manager is reduced, and the time overhead in the virtual instance state recovery process is reduced, which helps to reduce the pause time of the virtual instance caused by the virtualization manager upgrade. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The drawings described herein are used to provide a further understanding of the present disclosure and constitute a part of the present disclosure. The exemplary embodiments of the present disclosure and their descriptions are used to explain the present disclosure and do not constitute an improper limitation of the present disclosure. In the drawings:
[0029] FIG1 is a schematic diagram of the process of performing a KVM hot upgrade using a traditional KVM hot upgrade solution;
[0030] FIG2a is a schematic diagram of the internal structure of a host machine and a schematic diagram of the upgrade process of a virtualization manager provided by an embodiment of the present disclosure;
[0031] FIG2 b is another schematic diagram of the internal structure of the host machine and a schematic diagram of the upgrade process of the virtualization manager provided by an embodiment of the present disclosure;
[0032] FIG3 is a schematic diagram of a detailed process of upgrading a virtualization manager according to an embodiment of the present disclosure;
[0033] 4a and 4b are schematic flow charts of a method for upgrading a virtualization manager according to an embodiment of the present disclosure;
[0034] FIG5 is a schematic diagram of the structure of a computing device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0035] To make the objectives, technical solutions, and advantages of the present disclosure more clear, the technical solutions of the present disclosure will be clearly and completely described below in conjunction with the specific embodiments of the present disclosure and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments of the present disclosure, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present disclosure.
[0036] A Virtual Machine Monitor (VMM) is a computer program that runs on a host system and implements virtualization management functions. A VMM generally includes the emulator QEMU process and the kernel-based virtual machine management component (KVM).
[0037] KVM is a kernel virtualization component. Its primary functions include central processing unit (CPU) virtualization, memory virtualization, and interrupt virtualization. After the operating system loads the KVM module, users cannot directly control the kernel module's operations and must use other tools to create virtual machines.
[0038] QEMU is a process running in user mode. A virtual machine runs within the QEMU process, with each virtual CPU (VCPU) in the virtual machine corresponding to a thread in the QEMU process. The memory used by the virtual machine is allocated by the QEMU process on the host machine. Furthermore, the QEMU process is responsible for emulating virtual machine devices (such as the network card, keyboard, and mouse).
[0039] However, QEMU's standalone performance is poor. KVM can achieve high performance by leveraging interfaces provided by hardware virtualization. QEMU uses the open() command or close() command to open or close the / dev / kvm device interface file, and calls KVM's interface functions through the device Input / Output Control (ioctl) interface (ioctl()). This allows KVM to utilize hardware-assisted virtualization technologies, such as CPU virtualization, memory virtualization, and I / O virtualization.
[0040] Hypervisor hot upgrades are categorized as QEMU hot upgrades and KVM hot upgrades. This disclosure focuses on KVM hot upgrades. KVM hot upgrades prevent the VM from terminating or pausing for extended periods during the KVM upgrade process, thus avoiding interruptions to user services deployed on the VM and potentially causing significant jitter.
[0041] Traditional KVM hot upgrade solutions, as shown in Figure 1, typically employ local live migration. The QEMU process runs in the host machine's user state, while KVM runs in the host machine's kernel state. The new KVM is an upgrade of the original KVM and is typically loaded into kernel state by KVM maintenance personnel. Kernel state and user state are two different operating states of the operating system. In kernel state, operating system programs can run and hardware can be controlled; in user state, only application programs can run.
[0042] As shown in Figure 1, the traditional KVM hot upgrade solution mainly includes the following steps:
[0043] Step 1: The original QEMU process can create a new QEMU process in response to the KVM hot upgrade instruction; and load the new QEMU binary file in the new QEMU process to achieve QEMU hot upgrade.
[0044] The KVM hot upgrade command is typically issued by the hot upgrade management component in user mode. The hot upgrade management component can be triggered by operations and maintenance personnel to issue the KVM hot upgrade command to the original QEMU process. Alternatively, the hot upgrade management component can periodically issue the KVM hot upgrade command to the original QEMU process.
[0045] In step 2, the new QEMU process opens a new KVM and creates a structure object related to the virtual machine (VM). This creates a new VM. Structure objects are data structures used to store VM status information, such as kvm, kvm_vcpu, and kvm_device. The structure objects in step 2 are in their initial state and store VM status information.
[0046] After the new QEMU completes creating the new VM, it replies to the original QEMU with a message indicating that the virtual machine creation is complete.
[0047] Step 3: The original QEMU process responds to the virtual machine creation completion message and suspends the operation of the virtual machine on the host machine.
[0048] Step 4: The original KVM synchronizes the virtual machine state information in the original KVM with the original QEMU process through a large number of device input / output control (IOCTL) instructions. This virtual machine state information includes the CPU register status and the status of devices on the motherboard where the CPU resides. Devices on the motherboard where the CPU resides include, but are not limited to, the interrupt controller, interrupt-related devices, and other devices.
[0049] Synchronizing the state information recorded in a CPU register corresponds to one IOCTL call. Synchronizing the state of a device also corresponds to one IOCTL call. Since there are a large number of CPU registers and devices, synchronizing the virtual machine state information with the original QEMU requires a large number of IOCTL calls.
[0050] Step 5: The original QEMU process serializes the virtual machine state information and the state information of the virtual machine's simulated devices (such as the network card, keyboard, mouse, etc.), and saves the serialized state information in the user-state memory space. The new QEMU process can obtain the serialized state information from the user-state memory space and deserialize the serialized state information to obtain the virtual machine state information and the state information of the virtual machine's simulated devices.
[0051] Step 6: The new QEMU process transfers the virtual machine state information to the new KVM through a large number of IOCTL calls. The new KVM restores the state of the virtual machine based on the virtual machine state information, that is, restores the state of each structure object in the new KVM.
[0052] Step 7: The new QEMU process resumes the operation of the virtual machine. The original QEMU process releases occupied resources and exits.
[0053] According to the above-mentioned traditional KVM hot upgrade process, steps 4-6 of a traditional KVM hot upgrade are all completed while the virtual machine is suspended. These steps involve numerous IOCTL calls and multiple data copies, which increase the duration of the virtual machine's downtime. This results in a longer downtime for the KVM hot upgrade and leads to significant jitter in user applications deployed on the virtual machine. The downtime for a KVM hot upgrade refers to the duration that the virtual machine is suspended during the KVM hot upgrade.
[0054] In order to reduce the pause time of the virtual machine during the KVM hot upgrade process, in some embodiments of the present disclosure, during the virtualization manager upgrade process, when the virtual instance state is saved and restored, the memory address of the virtual instance state information is transmitted between the original virtualization manager and the upgraded new virtualization manager. Compared with the traditional solution in which the virtual instance state information needs to be copied back and forth between the user-state virtualization management process and the kernel-state virtualization manager, the amount of data copied between the original virtualization manager and the new virtualization manager is reduced, and the time overhead in the virtual instance state recovery process is reduced, which helps to reduce the pause time of the virtual instance caused by the virtualization manager upgrade.
[0055] The technical solutions provided by various embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0056] It should be noted that the same reference numerals denote the same objects in the following drawings and embodiments, and therefore, once an object is defined in one drawing or embodiment, it does not need to be further discussed in the subsequent drawings and embodiments.
[0057] Figure 2a is a schematic diagram of the internal system structure of a host computer provided by an embodiment of the present disclosure. The host computer can be implemented as any computer device with computing and storage functions, such as a server or terminal device. The terminal device can be a computer, workstation, or mobile phone.
[0058] A virtualization manager is deployed on the host machine. A virtualization manager is a computer program that manages virtualization instances and can be implemented as a software functional module or plug-in. A virtualization instance refers to multiple virtual servers deployed on a host machine using virtual machine technology to provide different services. A virtualization instance can be a virtual machine (VM), a container, or a container group (such as a Pod). A virtualization instance is also called a client (Guest). The host machine operating system is responsible for allocating hardware resources among multiple virtualization instances, making them independent of each other. The operating system of the virtualization instance can communicate with the hardware through the virtualization manager. Different implementations of virtualization instances require different virtualization managers.
[0059] For example, in an embodiment where the virtualized instance is a container or container group, an operating system virtualization architecture can be used to partition a single operating system on a host machine into multiple containers, which are managed using a container manager. Multiple refers to two or more containers. Accordingly, the virtualization manager is implemented as a container manager.
[0060] For another example, in an embodiment where the virtualized instance is a virtual machine, the underlying hardware resources are no longer partitioned. Instead, a virtual machine monitor (VMM) is installed on the host machine's operating system. The virtualization layer exists as application-level software and does not involve the operating system kernel. The virtualization layer simulates an independent set of hardware devices for each virtual machine, including hardware resources such as the processor, memory, motherboard, graphics card, and network card, on which the client operating system is installed. Accordingly, the virtualization manager is implemented as a VMM.
[0061] Hypervisors often release new versions to fix security vulnerabilities, functional issues, and other issues, necessitating hot upgrades. Hot upgrades ensure that virtual instances are not terminated during the upgrade process, and that virtual instances do not experience significant downtime. This prevents significant jitter in user applications deployed on these instances. The downtime of a virtual instance refers to the duration of downtime during the upgrade.
[0062] The following is an exemplary description of the upgrade process of the virtualization manager provided by the embodiment of the present disclosure.
[0063] As shown in Figure 2a, when a virtualization manager upgrade is required, a computer program corresponding to a new virtualization manager that upgrades the virtualization manager currently running on the host machine can be loaded onto the host machine to obtain a new virtualization manager. In the disclosed embodiment, for ease of description and distinction, the virtualization manager originally running on the host machine is defined as the first virtualization manager S10, and the new virtualization manager that upgrades the first virtualization manager is defined as the second virtualization manager S20.
[0064] During the virtualization manager upgrade process, the virtual instance status information in the first virtualization manager S10 needs to be synchronized with the second virtualization manager S20. The second virtualization manager S20 then manages the virtual instances on the host machine. Virtual instance status information refers to the status information of the virtual instances on the host machine, including but not limited to: status information of the virtual processor corresponding to the virtual instance (such as the status information recorded in the registers corresponding to the virtual processor) and status information of devices on the motherboard (such as the status information of the interrupt controller and other interrupt-related devices).
[0065] During the virtualization manager upgrade process, the faster the state of the virtual instance is restored in the second virtualization manager, the shorter the suspension time of the virtual instance, and the smaller the jitter of the user application on the virtual instance. In the embodiment of the present disclosure, to reduce the suspension time of the virtual instance, the first virtualization manager S10 can respond to the virtualization manager upgrade event and suspend the operation of the virtual instance on the host machine (corresponding to step 1 of Figure 2a).
[0066] The virtualization manager upgrade event may be triggered by an upgrade management component (not shown in FIG2a ) running in user mode. The upgrade management component may implement a software functional module or plug-in that manages virtualization manager upgrades. The upgrade management component may detect whether the host machine has a new virtualization manager; and when a new virtualization manager is detected, the virtualization manager upgrade event is triggered, and a process creation instruction is issued to the first virtualization manager S10 (not shown in FIG2a ). Alternatively, after loading the second virtualization manager into the host machine, the operation and maintenance personnel may use the calling interface provided by the upgrade management component to call the upgrade management component to trigger the virtualization manager upgrade event. In response to the virtualization manager upgrade event, the upgrade management component issues a process creation instruction to the first virtualization manager.
[0067] After the virtual instance is suspended, the state of the virtual instance can be migrated to the second virtualization manager S20, and the operation of the virtual instance can be resumed in the second virtualization manager S20 to achieve a hot upgrade of the virtualization manager. Based on this, in this embodiment, in order to migrate the state of the virtual instance to the second virtualization manager S20, the virtual instance state information in the first virtualization manager S10 is saved to the target memory of the host machine (corresponding to step 2 of Figure 2a). Specifically, the first virtualization manager S10 can apply for the target memory in the host machine; and save the virtual instance state information in the first virtualization manager S10 to the target memory. Further, the first virtualization manager S10 can provide the memory address information of the virtual instance state information to the second virtualization manager S20 (corresponding to step 3 of Figure 2a). The memory address information of the virtual instance state information can be the starting address and length of the virtual instance state information in the kernel memory space, etc.
[0068] Accordingly, the second virtualization manager S20 can obtain the memory address information of the target memory and, based on the memory address information of the target memory, obtain the virtual instance state information from the target memory. Furthermore, the second virtualization manager S20 can restore the state of the virtual instance in the second virtualization management component S20 based on the virtual instance state information, thereby implementing a hot upgrade of the virtualization manager (corresponding to step 4 in FIG. 2 a).
[0069] In traditional solutions, during virtual instance state preservation and restoration, virtual instance state information needs to be copied back and forth between the original virtualization manager and the new virtualization manager. It also needs to be copied back and forth between the user-mode virtualization management process and the kernel-mode virtualization manager. This large amount of data copying is time-consuming. In this embodiment, during virtual instance state preservation and restoration, the memory address of the virtual instance state information is transferred between the original and new virtualization managers. This reduces the amount of data copied between the original and new virtualization managers, shortens the virtual instance pause time caused by virtualization manager upgrades, and thus reduces jitter in user applications on the virtual instances, ensuring service performance.
[0070] In the disclosed embodiment, as shown in Figure 2b, the host machine is divided into user mode and kernel mode. Kernel mode and user mode are two different operating states of the operating system. In kernel mode, operating system programs can run and hardware can be controlled; in user mode, only application programs can run. Accordingly, the virtualization manager includes a virtualization management process 10 deployed in user mode and a virtualization management component 20 deployed in kernel mode.
[0071] The virtualization management component 20 deployed in kernel mode is a kernel virtualization component whose primary function is to implement processor virtualization, memory virtualization, and interrupt virtualization. After the operating system loads the virtualization management component 20, the user cannot directly control the operation of the kernel module and must use other tools to create virtual machines.
[0072] The virtualization management process 10 runs in user mode. Virtual machines run within the virtualization management process 10, and each virtual processor in the virtual machine corresponds to a thread in the virtualization management process. The memory used by the virtual machine is allocated by the virtualization management process on the host machine. Furthermore, the virtualization management process is responsible for emulating virtual machine devices (such as the network card, keyboard, and mouse).
[0073] However, the performance of the virtualization management process is poor when it runs independently. The virtualization management component 20 can be used to provide interfaces through some hardware virtualization functions to achieve high performance during runtime.
[0074] In some embodiments, the virtualization management component 20 may be KVM. Accordingly, the virtualization management process 10 may be a QEMU process. QEMU opens or closes the / dev / kvm device interface file using the open() command or close() method, and calls the interface functions provided by KVM using the device input / output control (ioctl) interface (ioctl()). This allows KVM to implement hardware-assisted virtualization technology-based CPU virtualization, memory virtualization, and I / O virtualization. Specifically, the user-mode virtualization management process 10 and the kernel-mode virtualization management component 20 collaborate to manage virtual instances on the host machine.
[0075] Virtualization managers frequently release new versions to address security vulnerabilities, functional issues, and other issues, necessitating hot upgrades. Hot upgrades for virtualization managers are categorized as hot upgrades of the virtualization management process and hot upgrades of kernel-deployed virtualization management components. This disclosure focuses on hot upgrades of kernel-deployed virtualization management components.
[0076] When the virtualization management component 20 running in kernel state needs to be upgraded, the computer program corresponding to the new virtualization management component that upgrades the virtualization management component 20 currently running in kernel state can be loaded into kernel state, resulting in a new virtualization management component deployed in kernel state. In the disclosed embodiment, for ease of description and distinction, the virtualization management component originally running in kernel state of the host machine is defined as the first virtualization management component 201, and the new virtualization management component that upgrades the first virtualization management component is defined as the second virtualization management component 202.
[0077] During the kernel-mode virtualization management component upgrade process, the virtual instance state information in the first virtualization management component 201 needs to be synchronized with the second virtualization management component 202. The second virtualization management component 202 then manages the virtual instance on the host machine. Virtual instance state information refers to the state information of the virtual instance on the host machine, including but not limited to: state information of the virtual processor corresponding to the virtual instance (e.g., state information recorded in registers corresponding to the virtual processor) and status information of devices on the motherboard (e.g., status information of the interrupt controller and other interrupt-related devices).
[0078] During the upgrade process of the virtualization management component 20 in the kernel state, the faster the state of the virtual instance is restored in the second virtualization management component 202, the shorter the pause time of the virtual instance, and the smaller the jitter of the user application on the virtual instance. In the embodiment of the present disclosure, in order to reduce the pause time of the virtual instance, in combination with Figure 2b and Figure 3, the original virtualization management process in the user state can create a new virtualization management process in the user state in response to the virtualization manager upgrade event (corresponding to step 1 in Figure 2b and steps 1-3 in Figure 3). In the embodiment of the present disclosure, for the convenience of description and distinction, the original virtualization management process in the user state is defined as the first virtualization management process 101; and the new virtualization management process created by the first virtualization management process 101 is defined as the second virtualization management process 102.
[0079] As shown in Figure 3, the virtualization manager upgrade event can be triggered by the upgrade management component 30 running in the user state. The upgrade management component 30 can implement a software functional module or plug-in that manages the virtualization management upgrade. The upgrade management component 30 can detect whether there is a new virtualization management component in the kernel state of the host machine; and when a new virtualization management component is detected, it triggers the virtualization manager upgrade event (corresponding to step 1 in Figure 3) and issues a process creation instruction to the first virtualization management process 101 (corresponding to step 2 in Figure 3). Alternatively, after the operation and maintenance personnel load the second virtualization management component 202 into the kernel state, they can use the calling interface provided by the upgrade management component 30 to call the upgrade management component 30 to trigger the virtualization manager upgrade event. In response to the virtualization manager upgrade event, the upgrade management component 30 issues a process creation instruction to the first virtualization management process 101.
[0080] For the first virtualization management process 101, the virtualization manager upgrade event is implemented by receiving a process creation instruction from the upgrade management component 30. Furthermore, in response to the process creation instruction, the first virtualization management process 101 creates a second virtualization management process 102 in user mode (corresponding to step 3 in FIG. 3 ). The second virtualization management process 102 collaborates with the second virtualization management component 202 to manage virtual instances on the host machine.
[0081] In some embodiments, the first virtualization management process 101 may create a child process of the first virtualization management process 101 in user mode in response to a virtualization manager upgrade event; and load the binary file of the virtualization management process in the child process to obtain the second virtualization management process 102 (corresponding to step 3 in Figure 3).
[0082] Specifically, as shown in step 3 of Figure 3, the first virtualization management process 101 can call a fork function (such as a fork function) in response to a virtualization manager upgrade event to create a child process of the first virtualization management process 101. The first virtualization management process 101 is the parent process, and the created process is called the child process. Because the fork function copies the memory image of the parent process, the new process receives a copy of the parent process's address space. After the fork function, the two processes will continue to execute subsequent instructions in their own memory space.
[0083] In this embodiment, the fork function creates a copy (i.e., a child process) of the calling process (i.e., first virtualization management process 101). However, many applications require that the child process execute different code from its parent process. The exec function provides the ability to overwrite the image of the calling process (i.e., parent process) with a new image. Combining the fork and exec functions allows the child process (using the exec function) to execute the new program while the parent process continues to execute the original program. Accordingly, as shown in step 3 of Figure 3, the first virtualization management process 101 can call the exec function to load the virtualization management process binary file into the child process, resulting in the second virtualization management process 102.
[0084] If a new version of the binary file exists in the host machine's user state, the binary file of the virtualization management process loaded in the child process is the new version of the binary file. In this case, the second virtualization management process is an upgraded version of the first virtualization management process, and the virtualization management process has been upgraded. If a new version of the binary file does not exist in the host machine's user state, the binary file of the virtualization management process loaded in the child process is the binary file corresponding to the original virtualization management process (i.e., the first virtualization management process), and the virtualization management process has not been upgraded.
[0085] In this embodiment, the second virtualization management process 102 collaborates with the second virtualization management component 202 in kernel state to manage virtual instances. Specifically, the upgrade management component 30 may include the identifier of the second virtualization management component 202 in the process creation instruction. When the first virtualization management process 101 creates the second virtualization management process 102, it may provide the identifier of the second virtualization management component 202 to the second virtualization management process 102.
[0086] Based on the identifier of the second virtualization management component 202, the second virtualization management process 102 can open the second virtualization management component 202. Further, the second virtualization management process 102 can create a structure object associated with the virtual instance in the second virtualization management component 202 (corresponding to step 4 in Figure 3). The structure object associated with the virtual instance refers to a data structure in the kernel-state virtualization management component 20 used to record the status information of the virtual instance, including but not limited to: a data structure used to record the status information of the registers associated with the virtual processor corresponding to the virtual instance and a data structure used to record the status information of the virtual device corresponding to the virtual instance.
[0087] Specifically, the second virtualization management process 102 may obtain an interface (e.g., a / dev / kvm interface) provided by the second virtualization management component 202 to the user state based on the identifier of the second virtualization management component 202. The second virtualization management process 102 may open the interface (e.g., a / dev / kvm interface) provided by the second virtualization management component 202 to the user state using an open command (e.g., an open() command) to open the second virtualization management component 202. The second virtualization management component 202 may return a file handle to the second virtualization management process 102. The second virtualization management process 102 may create a structure object associated with the virtual instance in the second virtualization management component 202 based on the file handle.
[0088] Specifically, the second virtual management process 102 can create a structure object associated with the virtual instance in the second virtualization management component 202 through an IOCTL instruction. The IOCTL instruction includes: a command and a file handle instructing the second virtualization management component 202 to execute. The IOCTL instruction can be IOCTL(fd1, cmd). fd1 is a file handle; cmd is a command instructing the second virtualization management component 202 to execute, and here the command is a creation command cmd. Accordingly, the second virtualization management component 202 can respond to the IOCTL instruction and create a structure object associated with the virtual instance in the second virtualization management component 202. The structure object associated with the virtual instance created at this time is the initial state of the virtual processor and device corresponding to the virtual instance, and can be used to run a new virtual instance.
[0089] After the structure object associated with the virtual instance is completed, the second virtual management process 102 may return a structure object creation completion message to the first virtual management process 101 (corresponding to step 5 in Figure 3). The first virtual management process 101 may suspend the operation of the virtual instance on the host machine in response to the virtualization manager upgrade event (corresponding to step 2 in Figure 2b and step 6 in Figure 3). Specifically, the first virtual management process 101 may suspend the operation of the virtual instance on the host machine after the structure object associated with the virtual instance is completed (corresponding to step 2 in Figure 2b and step 6 in Figure 3). Specifically, the first virtual management process 101 may suspend the operation of the virtual instance on the host machine after receiving the structure object creation completion message.
[0090] After the virtual instance is suspended, the state of the virtual instance can be migrated to the second virtualization management component 202, and the operation of the virtual instance can be resumed in the second virtualization management component 202, thereby realizing a hot upgrade of the kernel-state virtualization management component. Based on this, in this embodiment, in order to migrate the state of the virtual instance to the second virtualization management component 202, the first virtualization management process 101 can request the first virtualization management component 201 to save the state information of the virtual instance after the virtual instance is suspended. Specifically, the first virtualization management process 101 can send a virtual instance state save request to the first virtualization management component 201 after the virtual instance is suspended (corresponding to step 3 in Figure 2b and step 7 in Figure 3).
[0091] Accordingly, the first virtualization management component 201 saves the virtual instance state information in the first virtualization management component 201 to the target memory in the kernel state in response to the virtual instance state save request (corresponding to step 4 in Figure 2b and step 8 in Figure 3). Specifically, the first virtualization management component 201 applies for target memory in the kernel state in response to the virtual instance state save request; and saves the virtual instance state information in the first virtualization management component 201 to the target memory in the kernel state. Further, the first virtualization management component 201 may provide the memory address information of the virtual instance state information to the first virtualization management process 101 (corresponding to step 5 in Figure 2b and step 9 in Figure 3). The memory address information of the virtual instance state information may be the starting address and length of the virtual instance state information in the kernel state memory space, etc.
[0092] In some embodiments, after the virtual instance is suspended, the first virtualization management process 101 may send a virtual instance state save request to the first virtualization management component 201 via an IOCTL instruction. Accordingly, the virtual instance state save request may be implemented as an IOCTL instruction, which is used to request the first virtualization management component 201 to save the virtual instance state information. The IOCTL instruction may include: a save command instructing the first virtualization management component 201 to save the virtual instance state information, such as a save command, and may also include a file handle fd0 provided by the first virtualization management component 201. Accordingly, the first virtualization management component 201 may respond to the IOCTL instruction and save the virtual instance state information in the first virtualization management component 201 to the target memory in the kernel state; and return the memory address information of the virtual instance state information to the first virtualization management process 101 as the call result of the IOCTL instruction.
[0093] Optionally, the first virtualization management component 201 can respond to the IOCTL instruction and serialize the virtual instance state information in the first virtualization management component 201 to obtain serialized virtual instance state information (corresponding to step 8 in Figure 3). In this embodiment, serializing the virtual instance state information in the first virtualization management component 201 mainly refers to converting the virtual instance state information into a correspondence between a structure object and the state information of each structure object, so that when the virtual instance state is migrated to the second virtualization management component 202, the second virtualization management component 202 can determine which state information corresponds to which field of the structure object of the virtual instance based on the serialized virtual instance state information. Optionally, the correspondence between the structure object and the state information of each structure object can be implemented as a key-value pair (Key-Value, KV) structure. Among them, the field identifier of the structure object is a key (Key), and the state information corresponding to the field of the structure object is a value (Value).
[0094] Accordingly, the first virtualization management component 201 may return the memory address information of the serialized virtual instance state information to the first virtualization management process 101 as the call result of the IOCTL instruction (corresponding to step 9 in FIG. 3 ).
[0095] Furthermore, the first virtualization management process 101 may provide the memory address information of the virtual instance state information to the second virtualization management process 102 (corresponding to step 6 in FIG. 2 b and step 10 in FIG. 3 ). The second virtualization management process 102 may request the second virtualization management component 202 to restore the virtual instance state based on the memory address information of the virtual instance state information. Specifically, the second virtualization management process 102 may send a virtual instance state restoration request to the second virtualization management component 202, where the virtual instance state restoration request includes the memory address information of the virtual instance state information (corresponding to step 7 in FIG. 2 b and step 11 in FIG. 3 ).
[0096] Accordingly, the second virtualization management component 202 can respond to the virtual instance state recovery request and obtain the virtual instance state information from the target memory in the kernel state according to the memory address information of the virtual instance state information contained in the request (corresponding to step 7 in Figure 2b and step 12 in Figure 3).
[0097] In some embodiments, the second virtualization management process 102 can send a virtual instance state recovery request to the second virtualization management component 202 via an IOCTL instruction. Accordingly, the virtual instance state recovery request can be implemented as an IOCTL instruction, which is used to request the second virtualization management component 202 to restore virtual instance state information. The IOCTL instruction may include a recovery command instructing the second virtualization management component 202 to restore virtual instance state information, such as a restore command, and may also include the file handle fd1 provided by the second virtualization management component 202 and memory address information of the virtual instance state information.
[0098] Accordingly, the second virtualization management component 202 can respond to the IOCTL instruction, obtain the memory address information of the virtual instance state information, and obtain the virtual instance state information from the target memory in the kernel state according to the memory address information of the virtual instance state information included in the request.
[0099] For the above-mentioned embodiment in which the virtual instance state information is stored in a serialized form in the target memory in the kernel state, the second virtualization management component 202 can obtain the serialized virtual instance state information from the target memory in the kernel state according to the memory address information of the serialized virtual instance state information; and deserialize the serialized virtual instance state information to obtain the virtual instance state information (corresponding to step 12 in Figure 3).
[0100] In this embodiment, the kernel-state virtualization management component can directly serialize and deserialize the virtual instance state information in the kernel state, skipping the process of the user-state virtualization management process directly serializing and deserializing the virtual instance state information in the user state, reducing the processing time of the virtual instance state information, reducing the pause time of the virtual instance during the hot upgrade of the kernel-state virtualization management component, reducing the jitter of the user application on the virtual instance, and ensuring service performance.
[0101] Furthermore, the second virtualization management component 202 can restore the state of the virtual instance in the second virtualization management component 202 according to the virtual instance state information, thereby implementing a hot upgrade of the kernel-state virtualization management component (corresponding to step 8 in FIG. 2 b and step 13 in FIG. 3 ).
[0102] Specifically, the second virtualization management component 202 may assign a value to a structure object in the second virtualization management component 202 according to the virtual instance state information, thereby restoring the state of the virtual instance in the second virtualization management component 202 .
[0103] In this embodiment, during the kernel-mode virtualization management component upgrade, the original user-mode virtualization management process sends a virtual instance state save request to the original virtualization management component. The original virtualization management component responds to the request by saving the virtual instance state information to kernel-mode memory and returns the memory address of the virtual instance state information. This enables the original virtualization management process to save the virtual instance state through a single system call. Compared to traditional solutions that implement virtual instance state preservation through a large number of IOCTL-type system calls, this embodiment reduces the number of system calls during the virtual instance state preservation process, thereby reducing the time overhead of system calls during the virtual instance state preservation process. This helps reduce the virtual instance pause time caused by the kernel-mode virtualization management component upgrade, reduces jitter in user applications on the virtual instance, and ensures service performance.
[0104] On the other hand, in this embodiment, the new virtualization management process in user mode sends a virtual instance state recovery request containing the memory address of the virtual instance state information to the new virtualization management component. The new virtualization management component can obtain the virtual instance state information based on the memory address of the virtual instance state information and restore the virtual instance state in the new virtualization management component, thereby enabling the new virtualization management process to restore the virtual instance state through a single system call. Compared to traditional solutions that implement recovery through a large number of IOCTL-type system calls, this embodiment can reduce the number of system calls during the virtual instance state recovery process, thereby reducing the time overhead of system calls during the virtual instance state recovery process. This helps to reduce the virtual instance pause time caused by the virtualization management component upgrade, further reducing the jitter of user applications on the virtual instance, and ensuring service performance.
[0105] Furthermore, in traditional solutions, during virtual instance state preservation and restoration, virtual instance state information must be copied back and forth between the user-mode virtualization management process and the kernel-mode virtualization management component. This large amount of data copying takes a long time. In this embodiment, during virtual instance state preservation and restoration, the memory address of the virtual instance state information is transferred between the user-mode virtualization management process and the kernel-mode virtualization management component. This reduces the amount of data copied between the user-mode virtualization management process and the kernel-mode virtualization management component, further shortening the virtual instance pause time caused by virtualization management component upgrades, reducing jitter in user applications on the virtual instance, and ensuring service performance.
[0106] In addition to the aforementioned kernel-mode virtualization management component hot upgrade, embodiments of the present disclosure also provide a decoupling of user-mode virtualization management process upgrades from kernel-mode virtualization management component upgrades. This allows for flexible selection of whether to upgrade the user-mode virtualization management process during a kernel-mode virtualization management component hot upgrade. For example, a user interface can be provided to select whether to upgrade the user-mode virtualization management process, allowing the user to independently select whether to upgrade the virtualization management process.
[0107] In this embodiment, after restoring the state of the virtual instance, the second virtualization management component 202 may return a restoration completion message to the second virtualization management process 102. Optionally, the second virtualization management component 202 may return the restoration completion message to the second virtualization management process 102 as the result of the call of the IOCTL instruction for requesting the second virtualization management component 202 to restore the virtual instance state information. For embodiments in which the user-mode virtualization management process is upgraded, the second virtualization management process 102 may resume operation of the virtual instance on the host machine in response to the restoration completion message.
[0108] In the embodiment where the user-mode virtualization management process is not upgraded, since the file handle of the upgraded second virtualization management component 202 is opened by the second virtualization management process 102, the first virtualization management process 101 needs to obtain the operation handle of the second virtualization management component 202 before it can operate the upgraded second virtualization management component 202. Based on this, the second virtualization management process 102 can provide the target file handle it opened to the first virtualization management process 101 in response to the recovery completion message (step 14 in Figure 3) and release the resources occupied by the second virtualization management process 102. The target file handle opened by the second virtualization management process 102 is the file handle provided by the opened second virtualization management component 202, including the file handle fd1 in the process of opening the second virtualization management component 202, and also includes other file handles operated on the second virtualization management component 202.
[0109] After obtaining the target file handle, the first virtualization management process 102 may release the file handle of the original first virtualization management component 201 and continue to run based on the target file handle of the second virtualization management component 202. Specifically, the first virtualization management process 102 may resume the operation of the virtual instance on the host machine in the second virtualization management component 202 based on the target file handle (corresponding to step 9 in Figure 2b and step 15 in Figure 3).
[0110] Specifically, the first virtualization management process 102 sends an IOCTL instruction requesting the second virtualization management component to run the virtual instance based on the target file handle. The IOCTL instruction may include a command requesting the virtual instance to run, such as a run command. The second virtualization management component 202 responds to the IOCTL instruction and resumes the operation of the virtual instance on the host machine.
[0111] In this embodiment, by returning the file handle opened by the new virtualization management process to the original virtualization management process, it is possible to upgrade only the kernel-state virtualization management component while maintaining the original user-state virtualization management process, thereby improving the flexibility of virtualization manager operation and maintenance.
[0112] It is worth noting that the aforementioned virtualization management component upgrade process is applicable to both upgrading a single virtualization management component and simultaneously upgrading multiple virtualization management components. Multiple refers to two or more. The simultaneous upgrade process for multiple virtualization management components involves upgrading each virtualization management component individually, and the upgrade process is the same as the upgrade process for a single virtualization management component. When multiple virtualization management components are upgraded simultaneously, the new virtualization management component (i.e., the second virtualization management component) corresponding to each original virtualization management component (i.e., the first virtualization management component) can be the same or different, and the specific configuration can be flexibly set by the operation and maintenance personnel based on actual needs.
[0113] In addition to the virtualization manager upgrade system provided in the above embodiments, the present disclosure also provides a virtualization manager upgrade method. The following is an exemplary description of the virtualization manager upgrade method provided in the present disclosure.
[0114] FIG4a is a flow chart of a method for upgrading a virtualization manager according to an embodiment of the present disclosure. As shown in FIG4a , the method includes:
[0115] 41. In response to the virtualization manager upgrade event, the first virtualization manager suspends the operation of the virtual instance on the host machine.
[0116] 42. The first virtualization manager saves the virtual instance state information in the first virtualization manager to the target memory of the host machine; the virtual instance state information is the state information of the virtual instance.
[0117] 43. The first virtualization manager provides the address information of the target memory to the second virtualization manager; the second virtualization manager is used to upgrade the first virtualization manager.
[0118] 44. The second virtualization manager obtains virtual instance status information according to the memory address information.
[0119] 45. The second virtualization manager restores the state of the virtual instance in the second virtualization manager according to the virtual instance state information.
[0120] Virtualization managers often release new versions to fix security vulnerabilities, functional issues, and other reasons, which necessitates hot upgrades. When a virtualization manager upgrade is required, a computer program corresponding to the new virtualization manager that upgrades the currently running virtualization manager on the host machine can be loaded onto the host machine to generate the new virtualization manager. In the disclosed embodiments, for ease of description and distinction, the virtualization manager originally running on the host machine is defined as the first virtualization manager, and the new virtualization manager that upgrades the first virtualization manager is defined as the second virtualization manager.
[0121] During the virtualization manager upgrade process, the virtual instance state information in the first virtualization manager needs to be synchronized to the second virtualization manager, and then the second virtualization manager manages the virtual instance on the host machine. For the description of the virtual instance state information, please refer to the relevant content of the above embodiment and will not be repeated here.
[0122] During the virtualization manager upgrade process, the faster the state of the virtual instance is restored in the second virtualization manager, the shorter the virtual instance's pause time, and the less jitter experienced by user applications on the virtual instance. In the disclosed embodiment, to reduce the virtual instance's pause time, in step 41, the first virtualization manager may, in response to the virtualization manager upgrade event, suspend the operation of the virtual instance on the host machine. For a description of the virtualization manager upgrade event, please refer to the relevant content of the above embodiment and will not be repeated here.
[0123] After the virtual instance is suspended, the state of the virtual instance can be migrated to the second virtualization manager, and the operation of the virtual instance can be resumed on the second virtualization manager to achieve a hot upgrade of the virtualization manager. Based on this, in this embodiment, in order to migrate the state of the virtual instance to the second virtualization manager, in step 42, the first virtualization manager can save the virtual instance state information in the first virtualization manager to the target memory of the host machine. Specifically, the first virtualization manager can apply for the target memory in the host machine; and save the virtual instance state information in the first virtualization manager to the target memory. Further, in step 43, the first virtualization manager can provide the memory address information of the virtual instance state information to the second virtualization manager. The memory address information of the virtual instance state information can be the starting address and length of the virtual instance state information in the kernel memory space, etc.
[0124] Accordingly, in step 44, the second virtualization manager can obtain the memory address information of the target memory and, based on the memory address information of the target memory, obtain the virtual instance state information from the target memory. Furthermore, in step 45, the second virtualization manager can restore the state of the virtual instance in the second virtualization management component based on the virtual instance state information, thereby implementing a hot upgrade of the virtualization manager.
[0125] In traditional solutions, during virtual instance state preservation and restoration, virtual instance state information needs to be copied back and forth between the original virtualization manager and the new virtualization manager. It also needs to be copied back and forth between the user-mode virtualization management process and the kernel-mode virtualization manager. This large amount of data copying is time-consuming. In this embodiment, during virtual instance state preservation and restoration, the memory address of the virtual instance state information is transferred between the original and new virtualization managers. This reduces the amount of data copied between the original and new virtualization managers, shortens the virtual instance pause time caused by virtualization manager upgrades, and thus reduces jitter in user applications on the virtual instances, ensuring service performance.
[0126] In the disclosed embodiments, the host machine is divided into user mode and kernel mode. Accordingly, the virtualization manager includes a virtualization management process deployed in user mode and a virtualization management component deployed in kernel mode. Hot upgrades of the virtualization manager are divided into hot upgrades of the virtualization management process and hot upgrades of the virtualization management component deployed in kernel mode. The following description focuses on hot upgrades of the virtualization management component deployed in kernel mode.
[0127] FIG4 b is a flow chart of another method for upgrading a virtualization manager provided by an embodiment of the present disclosure. As shown in FIG4 b , the method mainly includes:
[0128] 401. In response to a virtualization manager upgrade event, a first virtualization management process creates a second virtualization management process in user mode; the second virtualization management process collaborates with a second virtualization management component.
[0129] 402. The first virtualization management process suspends the operation of the virtual instance on the host machine.
[0130] 403. The first virtualization management component saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state in response to the virtual instance state save request sent by the first virtualization management process.
[0131] 404. The first virtualization management component provides memory address information of the target memory to the first virtualization management process, so that the first virtualization management process provides the memory address information to the second virtualization management process.
[0132] 405. The second virtualization management component obtains virtual instance state information according to the memory address information in the virtual instance state recovery request sent by the second virtualization management process.
[0133] 406. The second virtualization management component restores the state of the virtual instance in the second virtualization management component according to the virtual instance state information.
[0134] When a virtualization manager running in kernel state needs to be upgraded, a computer program corresponding to a new virtualization management component that upgrades the virtualization management component currently running in kernel state can be loaded into kernel state, resulting in a new virtualization management component deployed in kernel state. In the disclosed embodiments, for ease of description and distinction, the virtualization management component originally running in kernel state of the host machine is defined as the first virtualization management component, and the new virtualization management component that upgrades the first virtualization management component is defined as the second virtualization management component.
[0135] During the kernel-state virtualization management component upgrade process, the virtual instance state information in the first virtualization management component needs to be synchronized to the second virtualization management component. Afterwards, the second virtualization management component manages the virtual instance on the host machine.
[0136] In this embodiment of the present disclosure, to reduce the pause time of virtual instances, in step 401, the original virtualization management process in user mode creates a new virtualization management process in user mode in response to a virtualization management component upgrade event. In this embodiment of the present disclosure, for ease of description and distinction, the original virtualization management process in user mode is defined as the first virtualization management process, and the new virtualization management process created by the first virtualization management process is defined as the second virtualization management process. The second virtualization management process collaborates with the second virtualization management component to manage virtual instances on the host machine.
[0137] In some embodiments, the first virtualization management process creates a child process of the first virtualization management process in user mode in response to a virtualization manager upgrade event; and loads a binary file of the virtualization management process in the child process to obtain a second virtualization management process.
[0138] Specifically, the first virtualization management process responds to the virtualization manager upgrade event, calls a replication function (such as a fork function) to create a child process of the first virtualization management process; and controls the first virtualization management process to call an exec function to load the binary file of the virtualization management process in the child process to obtain a second virtualization management process.
[0139] If a new version of the binary file exists in the host machine's user state, the binary file of the virtualization management process loaded in the child process is the new version of the binary file. In this case, the second virtualization management process is an upgraded version of the first virtualization management process, and the virtualization management process has been upgraded. If a new version of the binary file does not exist in the host machine's user state, the binary file of the virtualization management process loaded in the child process is the binary file corresponding to the original virtualization management process (i.e., the first virtualization management process), and the virtualization management process has not been upgraded.
[0140] In this embodiment, the second virtualization management process collaborates with the second virtualization management component in kernel state to manage the virtual instance. Specifically, the second virtualization management process opens the second virtualization management component. Furthermore, the second virtualization management process creates a structure object associated with the virtual instance in the second virtualization management component.
[0141] Specifically, the second virtualization management process can obtain the interface (such as the / dev / kvm interface) provided by the second virtualization management component to the user state based on the identifier of the second virtualization management component. Furthermore, the second virtualization management process opens the interface (such as the / dev / kvm interface) provided by the second virtualization management component to the user state by using an open command (such as the open() command) to open the second virtualization management component to obtain the file handle (File handle) returned by the second virtualization management process. Furthermore, the second virtualization management process can create a structure object associated with the virtual instance in the second virtualization management component based on the file handle.
[0142] Specifically, the second virtual management process creates a structure object associated with the virtual instance in the second virtualization management component through an IOCTL instruction. The IOCTL instruction includes a command for instructing the second virtualization management component to execute to create the data structure object and a file handle. Accordingly, the second virtualization management component responds to the IOCTL instruction and creates a structure object associated with the virtual instance in the second virtualization management component. The structure object associated with the virtual instance created at this time represents the initial state of the virtual processor and device corresponding to the virtual instance and can be used to run a new virtual instance.
[0143] After the second virtual management process completes the creation of the structure object associated with the virtual instance, it may return a structure object creation completion message to the first virtual management process. After the structure object associated with the virtual instance is completed, in step 402, the first virtual management process may suspend the operation of the virtual instance on the host machine in response to the virtualization manager upgrade event. The above step 41 can be implemented as this step 402.
[0144] After the virtual instance is suspended, the state of the virtual instance can be migrated to the second virtualization management component, and the second virtualization management component can resume the operation of the virtual instance, thereby implementing a hot upgrade of the kernel-mode virtualization management component. Based on this, in this embodiment, in order to migrate the state of the virtual instance to the second virtualization management component, the above step 42 can be implemented as follows: after the virtual instance is suspended, the first virtualization management process can request the first virtualization management component to save the state information of the virtual instance. Specifically, after the virtual instance is suspended, the first virtualization management process can send a virtual instance state save request to the first virtualization management component.
[0145] Accordingly, in step 403, the first virtualization management component saves the virtual instance state information in the first virtualization management component to the target memory in kernel state in response to the virtual instance state save request. Specifically, the first virtualization management component requests the target memory in kernel state in response to the virtual instance state save request, and saves the virtual instance state information in the first virtualization management component to the target memory in kernel state. Further, in step 404, the first virtualization management component may provide memory address information of the target memory to the first virtualization management process.
[0146] In some embodiments, after the virtual instance is suspended, the first virtualization management process may send a virtual instance state save request to the first virtualization management component via an IOCTL instruction. Accordingly, the virtual instance state save request may be implemented as an IOCTL instruction, which is used to request the first virtualization management component to save the virtual instance state information. The IOCTL instruction may include: a save command instructing the first virtualization management component to save the virtual instance state information, such as a save command, and may also include a file handle fd0 provided by the first virtualization management component. Accordingly, the first virtualization management component responds to the IOCTL instruction, saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state, and returns the memory address information of the virtual instance state information to the first virtualization management process as the call result of the IOCTL instruction.
[0147] Optionally, the first virtualization management component responds to the IOCTL instruction by serializing the virtual instance state information in the first virtualization management component to obtain serialized virtual instance state information. Further, the first virtualization management component returns the memory address information of the serialized virtual instance state information to the first virtualization management process as the call result of the IOCTL instruction.
[0148] Furthermore, the first virtualization management process provides the memory address information of the target memory to the second virtualization management process. The second virtualization management process may request the second virtualization management component to restore the virtual instance state based on the memory address information of the target memory. Specifically, the second virtualization management process may send a virtual instance state restoration request to the second virtualization management component, where the virtual instance state restoration request includes the memory address information of the virtual instance state information.
[0149] Accordingly, in step 405, the second virtualization management component responds to the virtual instance state recovery request and obtains the virtual instance state information from the target memory in the kernel state according to the memory address information of the target memory included in the request.
[0150] In some embodiments, the second virtualization management process sends a virtual instance state recovery request to the second virtualization management component via an IOCTL instruction. Accordingly, the virtual instance state recovery request can be implemented as an IOCTL instruction, which is used to request the second virtualization management component to restore virtual instance state information. The IOCTL instruction may include a recovery command instructing the second virtualization management component to restore virtual instance state information, such as a restore command, and may also include a file handle fd1 provided by the second virtualization management component and memory address information of the virtual instance state information.
[0151] Correspondingly, the second virtualization management component responds to the IOCTL instruction, obtains the memory address information of the target memory, and obtains the virtual instance state information from the target memory in the kernel state according to the memory address information of the target memory included in the request.
[0152] For the above-mentioned embodiment in which the virtual instance status information is stored in a target memory in the kernel state in a serialized form, the second virtualization management component can be controlled to obtain the serialized virtual instance status information from the target memory in the kernel state according to the memory address information of the serialized virtual instance status information; and the serialized virtual instance status information can be deserialized to obtain the virtual instance status information.
[0153] In this embodiment, the kernel-state virtualization management component can directly serialize and deserialize the virtual instance state information in the kernel state, skipping the process of the user-state virtualization management process directly serializing and deserializing the virtual instance state information in the user state, reducing the processing time of the virtual instance state information, reducing the pause time of the virtual instance during the hot upgrade of the kernel-state virtualization management component, reducing the jitter of the user application on the virtual instance, and ensuring service performance.
[0154] Furthermore, in step 406, the second virtualization management component may restore the state of the virtual instance in the second virtualization management component according to the virtual instance state information, thereby implementing a hot upgrade of the kernel-state virtualization management component.
[0155] Specifically, the second virtualization management component assigns a value to a structure object in the second virtualization management component according to the virtual instance state information, thereby restoring the state of the virtual instance in the second virtualization management component.
[0156] In this embodiment, during the kernel-mode virtualization management component upgrade, the original user-mode virtualization management process sends a virtual instance state save request to the original virtualization management component. The original virtualization management component responds to the request by saving the virtual instance state information to kernel-mode memory and returns the memory address of the virtual instance state information. This allows the original virtualization management process to save the virtual instance state through a single system call. Compared to traditional solutions that implement virtual instance state preservation through a large number of IOCTL-type system calls, this embodiment reduces the number of system calls during the virtual instance state preservation process, thereby reducing the time overhead of system calls during the virtual instance state preservation process. This helps reduce the virtual instance pause time caused by the virtualization management component upgrade, reduces jitter in user applications on the virtual instance, and ensures service performance.
[0157] On the other hand, in this embodiment, the new virtualization management process in user mode sends a virtual instance state recovery request containing the memory address of the virtual instance state information to the new virtualization management component. The new virtualization management component can obtain the virtual instance state information based on the memory address of the virtual instance state information and restore the virtual instance state in the new virtualization management component, thereby enabling the new virtualization management process to restore the virtual instance state through a single system call. Compared to traditional solutions that implement recovery through a large number of IOCTL-type system calls, this embodiment can reduce the number of system calls during the virtual instance state recovery process, thereby reducing the time overhead of system calls during the virtual instance state recovery process. This helps to reduce the virtual instance pause time caused by the virtualization management component upgrade, further reducing the jitter of user applications on the virtual instance, and ensuring service performance.
[0158] Furthermore, in traditional solutions, during virtual instance state preservation and restoration, virtual instance state information must be copied back and forth between the user-mode virtualization management process and the kernel-mode virtualization management component. This large amount of data copying takes a long time. In this embodiment, during virtual instance state preservation and restoration, the memory address of the virtual instance state information is transferred between the user-mode virtualization management process and the kernel-mode virtualization management component. This reduces the amount of data copied between the user-mode virtualization management process and the kernel-mode virtualization manager, further shortening the virtual instance pause time caused by virtualization management component upgrades, reducing jitter in user applications on the virtual instance, and ensuring service performance.
[0159] In addition to the aforementioned kernel-mode virtualization management component hot upgrade, embodiments of the present disclosure also provide a decoupling of user-mode virtualization management process upgrades from kernel-mode virtualization management component upgrades. This allows for flexible selection of whether to upgrade the user-mode virtualization management process during a kernel-mode virtualization management component hot upgrade. For example, a user interface can be provided to select whether to upgrade the user-mode virtualization management process, allowing the user to independently select whether to upgrade the virtualization management process.
[0160] In this embodiment, after restoring the state of the virtual instance, the second virtualization management component may return a restoration completion message to the second virtualization management process. Optionally, the second virtualization management component returns the restoration completion message to the second virtualization management process as the result of invoking the aforementioned IOCTL instruction for requesting the second virtualization management component to restore the virtual instance state information. For embodiments in which the user-mode virtualization management process is upgraded, the second virtualization management process may, in response to the restoration completion message, resume operation of the virtual instance on the host machine.
[0161] In the embodiment where the user-mode virtualization management process is not upgraded, since the file handle of the upgraded second virtualization management component is opened by the second virtualization management process, the original first virtualization management process needs to obtain the operation handle of the second virtualization management component before it can operate the upgraded second virtualization management component. Based on this, the second virtualization management process responds to the recovery completion message by providing the target file handle it opened to the first virtualization management process and releasing the resources occupied by the second virtualization management process.
[0162] After obtaining the target file handle, the first virtualization management process releases the file handle of the first virtualization management component and continues to operate based on the target file handle of the second virtualization management component. Specifically, the first virtualization management process resumes the operation of the virtual instance on the host machine in the second virtualization management component based on the target file handle.
[0163] Specifically, the first virtualization management process sends an IOCTL instruction to the second virtualization management component based on the target file handle, requesting the execution of the virtual instance. The IOCTL instruction may include a command requesting the execution of the virtual instance, such as a run command. Furthermore, the second virtualization management component responds to the IOCTL instruction and resumes the execution of the virtual instance on the host machine within the second virtualization management component.
[0164] In this embodiment, by returning the file handle opened by the new virtualization management process to the original virtualization management process, it is possible to upgrade only the kernel-state virtualization management component while maintaining the original user-state virtualization management process, thereby improving the flexibility of virtualization manager operation and maintenance.
[0165] It should be noted that the execution entity of each step of the method provided in the above embodiment can be the same device, or the method can be executed by different devices. For example, the execution entity of steps 401 and 402 can be device A; for another example, the execution entity of step 401 can be device A, and the execution entity of step 402 can be device B; and so on.
[0166] In addition, some of the processes described in the above embodiments and the accompanying drawings include multiple operations that appear in a specific order. However, it should be clearly understood that these operations may not be executed in the order in which they appear in this document or may be executed in parallel. The sequence numbers of the operations, such as 401 and 402, are merely used to distinguish between different operations and do not represent any execution order. In addition, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel.
[0167] Accordingly, an embodiment of the present disclosure further provides a computer-readable storage medium storing computer instructions. When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the above-mentioned virtualization manager upgrade method.
[0168] FIG5 is a schematic diagram of the structure of a computing device provided in an embodiment of the present disclosure. The computing device can be implemented as a host machine. As shown in FIG5 , the computing device may include: a memory 50a and a processor 50b. The memory 50a is used to store computer programs corresponding to the first virtualization manager and the second virtualization manager, as well as other computer programs. In this embodiment, the processor 50b is coupled to the memory 50a to execute the computer program stored in the memory 50a, so as to execute the steps in the upgrade method of the virtualization manager. For a detailed description of each method step, please refer to the aforementioned embodiment and will not be repeated here.
[0169] In some embodiments, the host machine's kernel state runs a first virtualization management component and a second virtualization management component of the virtualization manager that upgrades the first virtualization management component; the host machine's user state runs a first virtualization management process that collaborates with the first virtualization management component. Memory 50a is used to store computer programs corresponding to the first virtualization management component, the second virtualization management component, and the first virtualization management process, as well as other computer programs.
[0170] In this embodiment, the processor 50b is coupled to the memory 50a for executing the computer program to perform the steps of the virtualization manager upgrade method shown in FIG4b and its specific embodiment. Detailed descriptions of the steps of the method can be found in the above embodiments and will not be repeated here.
[0171] In some optional embodiments, as shown in FIG5 , the computing device may further include optional components such as a communication component 50c, a power component 50d, a display component 50e, and an audio component 50f. FIG5 illustrates only some of the components, and does not necessarily mean that the computing device must include all of the components shown in FIG5 , nor does it mean that the computing device can only include the components shown in FIG5 .
[0172] In addition, the components within the dashed box in Figure 5 are optional components, not required components, and their specific requirements depend on the product form of the electronic device. The computing device of this embodiment can be implemented as a terminal device such as a desktop computer, laptop computer, mobile phone, or IoT device; it can also be various server devices such as traditional servers, cloud servers, or server clusters.
[0173] In the embodiments of the present disclosure, the memory is used to store computer programs and can be configured to store various other data to support operations on the device where it is located. The processor can execute the computer program stored in the memory to implement the corresponding control logic. The memory can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random-access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0174] In the embodiments of the present disclosure, the processor may be any hardware processing device that can execute the logic of the above method. Optionally, the processor may be a central processing unit (CPU), a graphics processing unit (GPU), or a microcontroller unit (MCU); or a programmable device such as a field programmable gate array (FPGA), a programmable array logic device (PAL), a general array logic device (GAL), a complex programmable logic device (CPLD); or an advanced reduced instruction set (RISC) processor (Advanced RISC Machines, ARM) or a system on chip (SoC), etc., but is not limited thereto.
[0175] In an embodiment of the present disclosure, the communication component is configured to facilitate wired or wireless communication between the device in which it is located and other devices. The device in which the communication component is located can access a wireless network based on a communication standard, such as Wireless Fidelity (WiFi), 2G or 3G, 4G, 5G or a combination thereof. In an exemplary embodiment, the communication component receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component can also be based on Near Field Communication (NFC) technology, Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BT) technology or other technologies.
[0176] In an embodiment of the present disclosure, the display component may include a liquid crystal display (LCD) and a touch panel (TP). If the display component includes a touch panel, the display component may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation.
[0177] In an embodiment of the present disclosure, a power supply component is configured to provide power to various components of the device in which it is located. The power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply component is located.
[0178] In an embodiment of the present disclosure, the audio component may be configured to output and / or input audio signals. For example, the audio component includes a microphone (MIC), and when the device where the audio component is located is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal may be further stored in a memory or sent via a communication component. In some embodiments, the audio component further includes a speaker for outputting an audio signal. For example, for a device with a language interaction function, voice interaction with a user may be achieved through the audio component.
[0179] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0180] It should also be noted that the descriptions such as "first" and "second" in this article are used to distinguish different messages, devices, modules, etc., and do not represent the order of precedence, nor do they limit "first" and "second" to different types.
[0181] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, compact disc read-only memory (CD-ROM), optical storage, etc.) containing computer-usable program code.
[0182] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0183] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0184] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0185] In a typical configuration, a computing device includes one or more processors (CPU, etc.), input / output interfaces, network interfaces, and memory.
[0186] Memory may include non-permanent storage in a computer-readable medium, random-access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0187] Computer storage media is readable storage media, also known as computer-readable media. Computer-readable storage media include permanent and non-permanent, removable and non-removable media that can be implemented using any method or technology to store information. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices, or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0188] It should also be noted that the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, commodity, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, commodity, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a..." does not preclude the presence of additional identical elements in the process, method, commodity, or apparatus comprising the aforementioned elements.
[0189] The above contents are merely examples of the present disclosure and are not intended to limit the present disclosure. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present disclosure are intended to be included within the scope of the claims of the present disclosure.
Claims
1. A method for upgrading a virtualization manager, wherein: include: The first virtualization manager suspends the operation of the virtual instance on the host machine in response to the virtualization manager upgrade event; The first virtualization manager saves the virtual instance state information in the first virtualization manager to the target memory of the host machine; The virtual instance state information is state information of the virtual instance; The first virtualization manager provides the address information of the target memory to the second virtualization manager; the second virtualization manager is used to upgrade the first virtualization manager; The second virtualization manager obtains the virtual instance state information according to the memory address information; And according to the virtual instance state information, the state of the virtual instance is restored in the second virtualization manager.
2. The method according to claim 1, wherein: The first virtualization manager includes: a first virtualization management process running in user mode; The first virtualization manager suspends the operation of the virtual instance on the host machine in response to the virtualization manager upgrade event, including: The first virtualization management process, in response to a virtualization manager upgrade event, suspends the operation of the virtual instance on the host machine.
3. The method according to claim 2, wherein: The first virtualization manager also includes: a first virtualization management component running in kernel state; The first virtualization manager saves the virtual instance state information in the first virtualization manager to the target memory of the host machine, including: The first virtualization management process sends a virtual instance state saving request to the first virtualization management component; The first virtualization management component saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state in response to the virtual instance state saving request.
4. The method according to claim 3, wherein: The kernel state also runs a second virtualization management component; The second virtualization component is a component for upgrading the first virtualization management component, and the second virtualization manager includes: the second virtualization management component; The method further comprises: The first virtualization management process, in response to a virtualization manager upgrade event, creates a second virtualization management process in the user state; the second virtualization manager also includes the second virtualization management process; the second virtualization management process cooperates with the second virtualization management component; The first virtualization management component provides the memory address information of the target memory to the first virtualization management process; The first virtualization management process provides the memory address information of the target memory to the second virtualization management process.
5. The method according to claim 4, wherein: The second virtualization manager obtains the virtual instance state information according to the memory address information, including: The second virtualization management process sends a virtual instance state recovery request to the second virtualization management component; the virtual instance state recovery request includes memory address information of the target memory; The second virtualization management component obtains the virtual instance state information according to the memory address information of the target memory in response to the virtual instance state recovery request; The step of restoring the state of the virtual instance in the second virtualization manager according to the virtual instance state information includes: The second virtualization management component restores the state of the virtual instance in the second virtualization management component according to the virtual instance state information.
6. The method according to claim 4, wherein: The first virtualization management process creates a second virtualization management process in the user state in response to the virtualization manager upgrade event, including: In response to the virtualization manager upgrade event, the first virtualization management process creates a child process of the first virtualization management process in the user state; and loads a binary file of the virtualization management process in the child process to obtain the second virtualization management process.
7. The method according to claim 5, wherein: Also includes: The second virtualization management process opens the second virtualization management component and creates a structure object associated with the virtual instance in the second virtualization management component; The second virtualization management component restores the state of the virtual instance in the second virtualization management component according to the virtual instance state information, including: The second virtualization management component assigns a value to the structure object according to the virtual instance state information, so as to restore the state of the virtual instance in the second virtualization management component.
8. The method according to claim 7, wherein: The second virtualization management process opens the second virtualization management component and creates a structure object associated with the virtual instance in the second virtualization management component, including: The second virtualization management process opens the second virtualization management component to obtain a file handle provided by the second virtualization management component; The second virtualization management process creates a structure object associated with the virtual instance in the second virtualization management component according to the file handle.
9. The method according to claim 8, wherein: The second virtualization management process creates a structure object associated with the virtual instance in the second virtualization management component according to the file handle, including: The second virtualization management process sends, according to the file handle, to the second virtualization management component a first device input / output control IOCTL instruction for requesting the second virtualization management component to create a structure object; The second virtualization management component responds to the first IOCTL instruction and creates a structure object associated with the virtual instance.
10. The method according to claim 5, wherein: The first virtualization management component sends a virtual instance state saving request, including: The first virtualization management process sends a second IOCTL instruction for requesting the first virtualization management component to save virtual instance state information to the first virtualization management component as the virtual instance state saving request; The second virtualization management process sends a virtual instance state recovery request to the second virtualization management component, including: The second virtualization management process sends a third IOCTL instruction for requesting the second virtualization management component to restore the state of the virtual instance in the first virtualization management component to the first virtualization management process as the virtual instance state recovery request; the third IOCTL instruction includes memory address information of the virtual instance state information.
11. The method according to claim 5, wherein: The first virtualization management component responds to the virtual instance state saving request, and saves the virtual instance state information in the first virtualization management component to the target memory in the kernel state, including: The first virtualization management component responds to the virtual instance state saving request sent by the first virtualization management process, and obtains the virtual instance state information in the first virtualization management component; The first virtualization management component performs serialization processing on the virtual instance state information in the first virtualization management component to obtain serialized virtual instance state information; and The first virtualization management component saves the serialized virtual instance state information to the target memory in the kernel state.
12. The method according to claim 11, wherein: The second virtualization management component obtains the virtual instance state information according to the memory address information of the target memory in response to the virtual instance state recovery request, including: The second virtualization management component obtains the serialized virtual instance state information according to the memory address information of the target memory in response to the virtual instance state recovery request; The second virtualization management component deserializes the serialized virtual instance state information to obtain the virtual instance state information.
13. The method according to any one of claims 5 or 7-12, wherein: After the second virtualization management component restores the state of the virtual instance in the second virtualization management component according to the virtual instance state information, the method further includes: The second virtualization management process provides the opened target file handle to the first virtualization management process, and releases the resources occupied by the second virtualization management process; The first virtualization management process resumes the operation of the virtual instance in the second virtualization management component based on the target file handle.
14. The method according to claim 13, wherein: The first virtualization management process resumes the operation of the virtual instance in the second virtualization management component based on the target file handle, including: The first virtualization management process sends a request to the second virtualization management component based on the target file handle. Send the fourth IOCTL instruction requesting to run the virtual instance; The second virtualization management component responds to the fourth IOCTL instruction and resumes the operation of the virtual instance in the second virtualization management component.
15. A computing device, wherein: The computing device may be implemented as a host machine; The computing device comprises: a memory and a processor; wherein the memory is used to store computer programs corresponding to the first virtualization manager and the second virtualization manager, and other computer programs; The processor is coupled to the memory and is configured to execute a computer program stored in the memory to perform the steps in the method according to any one of claims 1 to 14.
16. A computer-readable storage medium storing computer instructions, wherein: When the computer instructions are executed by one or more processors, the one or more processors are caused to execute the steps in the method according to any one of claims 1 to 14.
17. A computer program, wherein: The method comprises computer instructions, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 14.
Citation Information
Patent Citations
Method and equipment for upgrading machine virtualizer on line
CN106293781A
Hot upgrade method and device for virtual machine management program and storage medium
CN114416148A
Virtual machine deployment and hot-migration methods, VMM upgrade method, and server
US20230009596A1